I'm still so new to JavaScript so bear with me. I am trying to get a dice roll to work in JavaScript when a button is clicked. I declared the roll function but when I recall it with a parameter the event listener only runs once when the page is loaded and that's it. Weirdly enough everything I find on google is from people specifically trying to get it to only run once. Thoughts?
document.querySelector('#roll').addEventListener('click', roll)
function roll(diceSides) {
console.log(Math.floor(Math.random() * diceSides) + 1)
}
roll(6)