I'm trying to show a random array taken from the two variable arrays and alternate between them, I don't care about storage. My code is not working and I don't know why.
var boy = ["have a shot", "item 2", "item 3"];
var girl = ["have a shot", "item 2", "item 3"];
var selector = 1;
function rbg()
if (selector == 1) {
document.getElementById("ppp").innerHTML = boy[Math.floor(Math.random() * boy.length)];
selector = 2;
} else if (selector == 2) {
document.getElementById("ppp").innerHTML = girl[Math.floor(Math.random() * girl.length)];
selector = 0;
} else {
document.getElementById("ppp".innerHTML = "have a shot each"; selector = 1;
}
<div id="random" onclick="rbg()">Random</div>
<p id="ppp">outcome</p>