I have to go through the following array and find the number that isn't a multiple of eight (58 at the end). I've been trying to figure out how to do it but nothing I tried really worked.
var multiplesOfEight = [8,16,24,32,40,58];
I tried this
var multiplesOfEight = [8,16,24,32,40,58];
if (multiplesOfEight % 8 === 0) {
console.log("Multiple of 8");
} else {
console.log("Wrong number");
}
and it just logs "Wrong number", I was expecting it to repeat "multiple of 8" five times and then wrong number but I guess that if/else is taking the array as a whole or something? An explanation of what exactly is happening with this if/else would also be appreciated.