I think there is a notion that I do not understand well, namely the notion of mutability.
Here is my code:
console.log(inputs); // Already sorted (?!)
// sort the array
inputs.sort(function(a, b) {
return a.order - b.order;
});
Only thing is, my console.log shows me the array inputs already sorted, while the .sort() method only applies afterwards.
I think it's a mutability problem, I just don't quite understand the scope of it. Why my console.log print the array already sorted ?
Thanks in advance