Hey guys some1 plz let me know how to play with jagged arrays


#1

Suppose i have created an jagged array like as newArray = [ [1,2,3], [4], [5,6,7,8] ];
And now i have created an object like newObj = { type='any', value='123' },
And now i want to place this object inside newArray b/w 1st array and 2nd array like as
newArray = [ [1,2,3], [{newObj}], [4], [5,6,7,8] ];


#2

var newObj = { type: 'any', value: '123' }; // you used wrong syntax
var newArray = [ [1,2,3], [newObj], [4], [5,6,7,8] ]; // you used wrong syntax
// or
var newArray = [ [1,2,3], newObj, [4], [5,6,7,8] ];

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.