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 -

c# - Create a Notification Object (Email or Page) At Run Time -- Dependency Injection or Factory -

Set Up Of Common Name Of SSL Certificate To Protect Plesk Panel -