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]]);    } } 

demo: http://jsfiddle.net/ct6nv/


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -