multidimensional array

I have an array like so

var items = [
  [1, 2],
  [3, 4],
  [5, 6]
];

Open in new window


How can I insert [7,8]?

The following is way off
items.push(7,8);

I have a SharePoint list and I am trying to add the SharePoint list item id and a corresponding date in a multidimensional array.
I want to later update the date and use the id to update the right item.

Any help would be appreciated.

Thanks!
LVL 5
IsaacSharePoint Client Side DeveloperAsked:
Who is Participating?
 
Ryan ChongConnect With a Mentor Commented:
tried:
items.push([7, 8]);

Open in new window

?
0
 
MrunalCommented:
hi
you can try below code:

var items = [
  [1, 2],
  [3, 4],
  [5, 6]
];
var NewArray = ['7', '8'];
items.push(NewArray);

Open in new window

0
 
IsaacSharePoint Client Side DeveloperAuthor Commented:
That stores it as a string and not a number.
0
 
IsaacSharePoint Client Side DeveloperAuthor Commented:
THanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.