0

Let's say I want an array and each array I want to numbers in that array, like

test[1] would output [2,1] or whatever.

I KNOW I can do just shove two numbers with a delimeter like "|" and it would output "2|1" but I wanted to know if there was an official way of adding two separate numbers in one array element...

1
  • So, you want a value that can hold multiple other values, like a list or so. Mmmmmh..... Commented Jul 27, 2014 at 14:50

2 Answers 2

3

You can use arrays as values too:

var test = [[4,3], [2,1]];
console.log(test[1]);
Sign up to request clarification or add additional context in comments.

Comments

1

Insert an array as an element of another array.

Example:

var dimensions = [];

dimensions[0] = [1,2];
dimensions[1] = [3,4];

Comments

Your Answer

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.