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.

0

1 Answer 1

56
obj.arrayOne.push(arrayLetters);

or

obj['arrayOne'].push(arrayLetters);
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.