Solved

multidimensional array

Posted on 2016-10-04
4
45 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 50

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

808 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