28

Questions:

  1. How can I push an Array into another Array located inside an Object?

Example Coding:

var myObj = {
 arrayOne: [],
 arrayTwo: []
};
var arrayLetters = ['A', 'B'];
/************************************ 
obj[arrayOne].push(arrayLetters); 
RESULT
 { 
 arrayOne: [['A', 'B']], 
 arrayTwo: [] 
 };
************************************/

Comments:

Essentially, I would like to have an key index for my various arrays.

asked Jun 19, 2014 at 22:27
0

1 Answer 1

56
obj.arrayOne.push(arrayLetters);

or

obj['arrayOne'].push(arrayLetters);
answered Jun 19, 2014 at 22:29
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.