How to change the position of object attributes in js

var obj = {

a:1,
b:2,
c:3

}

convert to

newobj = {

c:3,
b:2,
a:1

}

Mar.03,2021

object is unordered, and it looks like the adding order is not stable, so changing the "order" of key and using this "order" to execute some logic are unstable


var obj = {
  a: 1,
  b: 2,
  c: 3
};
var arr = [];
for (let i in obj) {
  arr.unshift(i);
}
JSON.parse(JSON.stringify(obj, arr));

.

Object.keys (obj). Reverse (). Reduce (b) = > (a [b] = obj [b])? A: {}, {})

but don't know what the meaning is?

Menu