function run() { var val1 = _.reduce([1, 2, 3], function (v, a) { return v + a; }); val2 = _([1, 2, 3]).reduce(function (v, a) { return v + a; }); console.log(val1 === val2); var eachVal = [1, 2, 3, 4]; //Yeilds each element to function t = _(eachVal).each(function (v) { return v * v; }); console.log(t === undefined); //Returns a new map of yielded elements t = _(eachVal).map(function (v) { return v * v; }); console.log(t.toString() === [1, 4, 9, 16].toString()); }
<button type="button" onClick='run()'>Run</button>