There is something bothers me. I'm trying to understand this output in console, take a look
listdata is a global variable.
I can use listdata.orders[x].id_order to return any numbers without errors.
Then I use for() to make a list and it gave me an error that doesn't make sense =/
EDIT: It needs to be limited as 9 items, not complete as data.length
Use this
listdata.orders.forEach(function (order) {
console.log(order.id_order);
});
To limit the iteration to 9 orders.
Method 1:
listdata.orders.slice(0, 9).forEach(function (order) {
console.log(order.id_order);
});
Method 2:
listdata.orders.some(function (order, index) {
if (index > 9) {
return true;
}
console.log(order.id_order);
});
var a = listData.orders; //All Orders
for(var b in a)
{
var c = [b];
console.log(c,c.id_order); //Know the values...
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.