JavaScript Video Tutorial - Using reduce() and reduceRight() functions in UnderscoreJS

preview_player
Показать описание
In this demonstration, we will use reduce() and reduceRight() functions to reduce collections to a single value.
Рекомендации по теме
Комментарии
Автор

That array of colors ended up being a little bit of a tease, huh?
 but great video, very easy to follow. Thanks

jmancherjeee
Автор

Why don't we use the default js reduce method like below? It is faster and has not more code:
(Just of more number of callback params?)
var arr = [1, 2, 3, 4, 5];
var result = arr.reduce(function(sum, current) {
return sum + current;
});

alert( result ); // 15

dmitriydorogonov
join shbcf.ru