I'm working on a drag and drop card game. I'm able to use sort and use Math.Random to shuffle:
answers.sort( function() { return Math.random() - .5 } );
It works but after the cards are placed in the correct subcontainer the wrong year appears below as if it's shuffling.
Is it possible to shuffle an array by the image but still be able to sort by value(order)?
var answers = [
{
"image":'https://www.floridamemory.com/onlineclassroom/game/cards/1822.png',
"order":'1'
},{
"image":'https://www.floridamemory.com/onlineclassroom/game/cards/1839.png',
"order":'2'
},
{
"image":'https://www.floridamemory.com/onlineclassroom/game/cards/1912.png',
"order":'3'
}
];