Solved

multidimensional array

Posted on 2016-10-04
4
56 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 52

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
When using a search centre, I'm going to show you how to configure Sharepoint's search to only return results from the current site collection. Very useful when using Office 365 with multiple site collections.
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…

728 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