Tuesday, 15 May 2012

Create Javascript object with one array property -



Create Javascript object with one array property -

how create javascript object runtime following

task{ timestamp:string; tasklist: array of object }

you can utilize object initialiser that:

var task = { timestamp: "this string", tasklist: [] };

[] creates array (an empty one). javascript doesn't have "array(s) of object," standard array can hold anything. (javascript does, these days, have typed arrays other things, 8-bit integers, not objects.)

javascript arrays javascript-objects

No comments:

Post a Comment