If I enter the code line by line in a web console without the function() wrap (I use Chrome), it does what I want it to do, but I'm a bit stumped on why the code itself is returning 'undefined' as a block itself:
function () {
var x = [];
x[0] = {'first': 1, 'second': 2, 'third': 3};
return x;
}
I tried pushing the object with the x.push() function, but I don't think that really works either - many articles I've researched say I cannot use the .push() function with javascript objects. Basically I want the code to return:
[ {'first': 1, 'second': 2, 'third': 3} ]
Appreciate your help!