Saturday, 15 June 2013

javascript - NodeJS Count how many objects in array? -


How can I count how many objects are inside the array?

looks like an array:

  [{id: 1}, {id: 2}, ...]  
< P> I think I can use counting () if it was PHP, but what about NODJS / Javascript?

Edit:

asd

  if (offer.items_to_receive.length & gt; 0) {console.log ("item:" + offer.items_to_receive.length); (Var i = 0; i  

How can it read "worth X tickets", but not the other part?

use

  var data = [{id: 1} , {Id: 2}]; Console.log (data.length);      

Update , in my edit, I think

offer .items_to_receive is undefined , make sure the object proposal is the property items_to_receive (should be array);


No comments:

Post a Comment