Hi
I'm a code cadet and I'm having trouble with this exercise:
"We've already declared a variable for you in the editor called number to which the value 42 was assigned.
Use a for loop to go through all numbers from number up to 50 (both inclusive), and check if they are multiples of 3. If they are, print them."
My code is:
var number = 42
for (var number = 42; number <= 50; number++) {
if (number % 3 === 0)
console.log(number);
}
And the result is >>>>Code is incorrect
You should have an if statement to check if each value of the variable number is a multiple of 3
I can't find what I'm doing wrong, can you please help me? Also the answer that is giving me it's '51' and that's not a multiple o 3.
Thanks!