I came across the comments committed before, improving recursion function with "array.reverse().reduce()". The bro replied with "array.reduceRight()". OMG, so embarrassed. I didn't notice such method, which has been added in ES5, until he mentioned.
Handling data in array format is so common in both JavaScript and TypeScript. And I find that it really improves a lot when using these prototype methods of Array. Just for records, I will keep updating the series.
Firstly, please check the Specifications for the updates in per version(ECMA 1st version, ES5, ES6(ES 2015), ES7(ES 2016)) and Browser compatibility.

References:
1. Array in MDN web doc: 点击打开链接

本文探讨了通过使用JavaScript中Array的prototype方法如array.reverse().reduce()和array.reduceRight()来改进递归函数的方法。这些技巧对于处理数组格式的数据特别有用,并且能够显著提高性能。文中还提到了ECMAScript不同版本的更新规格及浏览器兼容性。
361

被折叠的 条评论
为什么被折叠?



