reverse object javascript

Solutions on MaxInterview for reverse object javascript by the best coders in the world

showing results for - "reverse object javascript"
Ivanna
10 Nov 2018
1var x = [{"score":1},{"score":2},{"score":3}]
2console.log(x);
3
4var y = x.reverse();
5console.log(y);
6
7if the above method does not work than try this
8
9var y = [...x].reverse();
10console.log(y);
Awa
05 Apr 2020
1function reverseObject(obj){
2
3  var array = [];
4
5  for (var i in obj) {
6    array.push(obj[i]);
7  }
8
9  array.reverse();
10
11  return array;
12
13}
similar questions
queries leading to this page
reverse object javascript