const cardArray = [ {a:1},{a:2},{a:3},{a:5} ]
//first console.log
console.log(cardArray);
cardArray.sort((a,b) => 0.5 - Math.random());
//second console.log
console.log(cardArray);
Why I'm getting the same result in the first and second console.log() ?
Note: I get the expected result when I use an array with number elements.
example :
const cardArray = [1,2,3,5]
- first
cosole.log()
---> [1,2,3,5]. - second
cosole.log()
----> [3,5,1,2]