0

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?

1 Answer 1

3

groupBy() returns an object, not an array.

It has no length property.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.