enter image description here
I want to start it from NV to 1952
2
You can use Object.keys and reverse method.
Object.keys(object) .reverse() .forEach((item) => { console.log(item, ":", object[item]); });
Basically, it doesn’t make any sense to reverse objects as objects are not in order.
let dummyObj = {a: 1, b: 2, c: 3}; let entries = Object.entries(dummyObj ); let reversedEntries = entries.reverse(); let reversedObj = Object.fromEntries(reversedEntries); console.log(reversedObj);
Click here to cancel reply.
2
Answers
You can use Object.keys and reverse method.
Basically, it doesn’t make any sense to reverse objects as objects are not in order.