I'm new at javascript. I have this code, and I want to select a random image.
const catbutton=document.getElementById('catbutton')
const cubebutton=document.getElementById('cubebutton')
const image=document.getElementById('image')
var arr= ["pr1.jpg", "pr2.jpg"]
const randomElement = arr[Math.floor(Math.random() * arr.length)];
alert(randomElement)
console.log(image.src=(randomElement));
<img id=image src="" alt="">
Here is the image HTML part:
<img id=image src="" alt="">