I am trying to make my images to shuffle using the following code using jQuery, but I got stuck.
const $images = [
{ name: "dinosaurs", image: "../Images/dinosaurs.jpg"},
{ name: "friends", image: "../Images/Friends.jpg" },
{ name: "badguys", image: "../Images/bad_pack.jpg"}
];
const $random = () => {
for(let character of $images) {
console.log(character);
const $square = $("#draw-square");
$square.css("background", $images[Math.floor(Math.random() * 3)].image
)}
}
Any suggestions, thanks