Answers for "reverse object javascript"

0

how to reverse array of object

var x = [{"score":1},{"score":2},{"score":3}]
console.log(x);

var y = x.reverse();
console.log(y);

if the above method does not work than try this

var y = [...x].reverse();
console.log(y);
Posted by: Guest on June-18-2021
0

reverse object javascript

function reverseObject(obj){

  var array = [];

  for (var i in obj) {
    array.push(obj[i]);
  }

  array.reverse();

  return array;

}
Posted by: Guest on September-29-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language