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

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -