I'm looking for a a way to iterate over a Set or Map in reverse order.
Consider this simple example in regular order:
var mySet = new Set([1,2,3,4,5]);
for(let myNum of mySet) {
console.log(myNum); // output: 1, 2, 3, 4, 5 in sepearte lines
}
The iterator given from Set.prototype.values() or Set.prototype.entries() are also from start to beginning.
What would be the solution to iterate the Set (or Map) in the reverse order?