Javascript examples for Array:reduce
Check this to if it is set to current object inside array.prototype.reduce()
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from www.ja v a2 s.com function callback(previous,current,index,array){ console.log(this); return previous+current; } [1,2,3,4,5].reduce(callback); var myObject = {}; [1,2,3,4,5].reduce(callback.bind(myObject)); } </script> </head> <body> </body> </html>