128
rated 0 times
[
135]
[
7]
/ answers: 1 / hits: 24719
/ 6 Years ago, sun, august 19, 2018, 12:00:00
As the title says, I'd like to reverse an array made of objects in Javascript.
Example : var x = [{score:1},{score:2},{score:3}]
To do so, I'm using the .reverse() method.
Now, let's say I write this code
console.log(x);
x.reverse();
console.log(x);
I'm expecting the console to show the array in the original order, then in a reversed order. However, It really shows both arrays in the reversed order.
How come ?
More From » arrays