javascript - Access array element with a dot in its name -
i'm reading data database , loading in array. when print console this:
[ {'person.name':'name1', total:1}, {'person.name':'name2', total:100} ]
so iterate through code:
for(var i=0;i<arr.length;i++){ console.log(arr[i].total); }
i can access total how can access 'person.name'?
access array :
arr[i]['person.name'];
here's more info on why/when use notation : javascript property access: dot notation vs. brackets?
Comments
Post a Comment