Both creates wrapper, but I thought it was exactly the same. However for:
_.chain([1,2,3]).forEach(function(a){console.log(a);});
... i will need to add .value() to get the same result (logging in console) as this:
_([1,2,3]).forEach(function(a){console.log(a);});
While _() docs says Methods that retrieve a single value or may return a primitive value will automatically end the chain sequence and return the unwrapped value
_.chain says The result of such sequences must be unwrapped with _#value
It means that usually you would like to use _() but sometimes you would like to use _.chain() instead of doing additional _() on intermediate results
Thanks for the clarification
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
While
_()docs saysMethods that retrieve a single value or may return a primitive value will automatically end the chain sequence and return the unwrapped value_.chainsaysThe result of such sequences must be unwrapped with _#valueIt means that usually you would like to use
_()but sometimes you would like to use_.chain()instead of doing additional_()on intermediate results