javascript - How can I get the value in an array of array Object? -
var data=[ { 'name':'yash', 'phoneno':['123456','654123'] }, { 'name':'rahul', 'phoneno':['789456','789456'] } ]; for(i=0;i<data.length;i++) { alert(data[i].phoneno.length); for(j=0;j<data[i].phoneno.length;j++) { alert(data[i][j].phoneno); }
how can access value array 'phone' object data ? tried this,but not working. thank in advance
var data=[ { 'name':'yash', 'phone':['123456','654123'] }, { 'name':'rahul', 'phone':['789456','789456'] } ]; for(i=0;i<data.length;i++) { alert(data[i].phone.length); for(j=0;j<data[i].phone.length;j++) { alert(data[i].phone[j]); } }
replaced phoneno
phone
, alert(data[i][j].phone);
alert(data[i].phone[j]);
Comments
Post a Comment