|
1 | 1 | #JavaScript-snippets
|
2 |
| ->Click:star:if you like the project. Pull Request are highly appreciated. Follow us on[Facebook](https://www.facebook.com/snippetsJS) |
| 2 | +>Click:star:if you like the project. Pull Request are highly appreciated. Follow us on[Facebook](https://www.facebook.com/snippetsJS) |
3 | 3 |
|
4 | 4 | ###Table of Contents
|
5 | 5 | | No.| Questions|
|
|
39 | 39 | |33|[replaceAll](#replaceAll)|
|
40 | 40 | |34|[Required Function Params](#Required-Function-Params)|
|
41 | 41 | |35|[Get input value as a number](#Get-input-value-as-a-number)|
|
| 42 | +|36|[reduceRight](#reduceRight)| |
42 | 43 |
|
43 | 44 |
|
44 | 45 |
|
@@ -753,4 +754,24 @@ function checkMyType(event){
|
753 | 754 |
|
754 | 755 | }
|
755 | 756 |
|
| 757 | +
|
| 758 | +``` |
| 759 | +**[⬆ Back to Top](#table-of-contents)** |
| 760 | +### reduceRight |
| 761 | +
|
| 762 | +```javascript |
| 763 | +
|
| 764 | +const arr = ["a","b","c","d","e"] |
| 765 | +
|
| 766 | +const reduceArray = arr.reduce((acc, current) => { |
| 767 | + return acc + current |
| 768 | +},"") |
| 769 | +//return abcde |
| 770 | +
|
| 771 | +const reduceRightArray = arr.reduceRight((acc, current) => { |
| 772 | + return acc + current |
| 773 | +},"") |
| 774 | +//return edcba |
| 775 | +
|
756 | 776 | ```
|
| 777 | +
|