The arr.length
is still undefined after I call _.chain()
underscore operation:
var arr = _.chain(msg)
.groupBy(function(item) {return item.ts_simple; })
.value();
console.log(arr.length); //undefined
console.log(arr); //correct object array
The first console.log(arr.length)
for underscore var
array length is undefined
while the console.log(arr)
outputs the correct returned object array.
How do I callback after underscore operation is complete?
groupBy()
returns an object, not an array.
It has no length
property.
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.