skip to Main Content

enter image description here

I want to start it from NV to 1952

2

Answers


  1. You can use Object.keys and reverse method.

    Object.keys(object)
      .reverse()
      .forEach((item) => {
        console.log(item, ":", object[item]);
      });
    Login or Signup to reply.
  2. 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);
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search