2/33 Why Does it Come up True even when X % 8 === 0?


#1

Im using the code that was prompted, but whenever I plug in a multiple of 8 it lets me complete the course. I though that the code said if the number divided by 8 gives a remainder then its true. Well 16/8 does not give a remainder but it still comes back true. Sorry if this was explained in poor manner I'm just very confused.


#2

The instruction:
Look at the array multiplesOfEight, and find the one that doesn't fit.
Replace X in line 6 such that the variable answer is assigned the Boolean value of true.

The code provided:

// Here is an array of multiples of 8. But is it correct?
var multiplesOfEight = [8,16,24,32,40,58];

// Test to see if 
//   a number from the array 
//   is NOT a true multiple of eight.
//
// Real multiples will return false.
//
var answer = multiplesOfEight[5] % 8 !== 0;

If you use the not-equal-operator !== in your comparison
then your problem is solved.
Have a read through compariison-operator at
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators


#4

@anastasia_ld,
Your program is not ready...as the Instruction ask only the true-one to be displayed....

PS.
In the [Initialization] part of the FOR-loop Always use the var key-word.