Solved

multidimensional array

Posted on 2016-10-04
4
34 Views
Last Modified: 2016-10-04
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!
0
Comment
Question by:Isaac
  • 2
4 Comments
 
LVL 49

Accepted Solution

by:
Ryan Chong earned 500 total points
ID: 41829259
tried:
items.push([7, 8]);

Open in new window

?
0
 
LVL 22

Expert Comment

by:Mrunal
ID: 41829261
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
 
LVL 5

Author Comment

by:Isaac
ID: 41829265
That stores it as a string and not a number.
0
 
LVL 5

Author Closing Comment

by:Isaac
ID: 41829267
THanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now