What kind of array is this in JavaScript? -
i have array looks this:
var locationsarray = [['title1','description1','12'],['title2','description2','7'],['title3','description3','57']];
i can't figure out type of array is. more importantly, i'm gonna have create 1 based on info there. so, if number on end greater 10 create brand new array in same exact style, title , description.
var newarray = []; // guess if(locationsarray[0,2]>10){ //add newarray : ['title1','description1'],['title3','description3'] ? }
how can it?
try below,
var newarray = []; (var = 0; < locationsarray.length; i++) { if (parseint(locationsarray[i][2], 10) > 10) { newarray.push([locationsarray[i][0], locationsarray[i][1]]); } }
Comments
Post a Comment