I have 9 blocks, where it is necessary that when reloading the background image, pictures from the folder are loaded without repeating. How can I implement this?
When I click on the button, I reload the page, then I interfere with the array. How then to get these pictures?
<div class="game">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
const imgCollection = [
"assets/img/1.png",
"assets/img/2.png",
"assets/img/3.png",
"assets/img/4.png",
"assets/img/5.png",
"assets/img/6.png",
"assets/img/7.png",
"assets/img/8.png",
"assets/img/9.png",
];
reset.addEventListener("click", () => {
location.reload();
x=imgCollection.sort(()=>Math.random()-0.5);
});