javascript - JS fill Object as an array -
can tell me how fill element array
testdata = [ { key: "one", y: 200 }, { key: "two", y: 300 } ];
example:
testdata=[]; testdata[]="one"; testdata[]="two";
it's better write function constructs json object. call createobject , can use loop like:
var list = []; for(var = 0; < 10; i++) { var obj = createobject(i); //add other params if need list.push(obj); } return list;
Comments
Post a Comment