Javascript examples for Array:reduceRight
Array reduceRight() and asynchronous function callback
<html> <head></head> <body> <script> var func = function(arg, next) { setTimeout(function(){/*from w w w . ja v a 2 s.c o m*/ console.log(arg); next(); }, 1000); }; var arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; var fn = arr.reduceRight(function (a, b) { return func.bind(null, b, a); }, function (){ console.log('finish'); }); fn(); </script> </body> </html>