I came across the comments committed before, improvingrecursion 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 me
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: 点击打开链接