Selecting Item inside Child Arrays Javascript -
i produce array , want grab first item in each of child arrays:
arrayname = [[item1,item2,item3,item4],[item1,item2,item3,item4],[item1,item2,item3,item4]];
i'm trying in loop:
var num = arrayname.length; (i=0; < num; i++) { var title1 = arrayname[i][0]; }
but on alert:
alert(title1); = [ [ [
i need:
alert(title1); = item1 item1 item1
i've tried using .nodevalue, .firstchild, etc still not finding answer. what's right way?
var num = arrayname.length; var title1 = new array(); (i=0; < num; i++) { title1.push(arrayname[i][0]); } console.log(title1);
better?
Comments
Post a Comment