JavaScript: Push into an Array inside an Object? -
JavaScript: Push into an Array inside an Object? -
questions:
how can force array array located within object?example coding:
var myobj = { arrayone: [], arraytwo: [] }; var arrayletters = ['a', 'b']; /************************************ obj[arrayone].push(arrayletters); result { arrayone: [['a', 'b']], arraytwo: [] }; ************************************/
comments:
essentially, have key index various arrays.
obj.arrayone.push(arrayletters);
or
obj['arrayone'].push(arrayletters);
javascript arrays object push
Comments
Post a Comment