Hello StackOverflow community!
At the moment I am completly stuck with my code, have try different ways to remove a value from array when picked, I know I have to use sp
You can use splice()
to remove an item from the array, since splice returns an array then you can access the element at the index 0 to get the fetched src value
'<div class="back"><img src="./kaart/' + cars.splice(Math.floor(Math.random() * cars.length),1)[0] + '.png"</img> </div>'
First, put the random-number in a seperate variable
var rnd = Math.floor(Math.random()*cars.length);
var rand = cars[rnd];
Then remove that specific item from the array
cars.splice(rnd, 1);
Cheers R