题解 | #Array.reduce#
Array.reduce
https://www.nowcoder.com/practice/213d0ef21cb841de8cf69fcc5ea60eb6
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <style> /* 填写样式 */ </style> </head> <body> <!-- 填写标签 --> <script type="text/javascript"> // 填写JavaScript Array.prototype._reduce = function(Fn){ if(typeof Fn !== 'function')return let sum = 0 for(let i = 0;i < this.length-1;i++){ sum += Fn(this[i],this[i+1]) } return sum } </script> </body> </html>