So my Javascript code is supposed to randomly pick, but it always picks the first option, even if I switch the options, it always goes to the one on top. Did I make an error, or how can I get this to work?
function test() {
var values = ["1","2"],
valueToUse = values[Math.floor(Math.random() * values.length)];
// do something with the selected value
alert(valueToUse);
}
if (values = 1) {
window.location = "tail.html"; }
else if (values = 2) { window.location = "head.html"; }