I want to use the map() function on a javascript array, but I would like it to operate in reverse order.
map()
The reason is, I\'m rendering stacked React co
You can use Array.prototype.reduceRight()
Array.prototype.reduceRight()
var myArray = ["a", "b", "c", "d", "e"]; var res = myArray.reduceRight(function (arr, last, index, coll) { console.log(last, index); return (arr = arr.concat(last)) }, []); console.log(res, myArray)