Multiples of Eight - Using a For Loop


#1


https://www.codecademy.com/courses/spencer-sandbox/0/2?curriculum_id=506324b3a7dffd00020bf661#

Hi,

I have 'passed' the exercise but I don't understand what's happening. I am trying to write a 'for' loop that prints: true, true, true, true, true, false - thereby identifying which of the bits in the array is not a multiple of 8.

Below is my attempt to do this, but nothing is printing to the console.log bit. Could anyone explain to me what's happening?

Thanks
Joe.


var multiplesOfEight = [8,16,24,32,40,58];
for (i = 0; i>multiplesOfEight.length; i+=1) {
    console.log(multiplesOfEight[i]%8===0)
    }


#2

Hi thsi part

for (i = 0; i>multiplesOfEight.length; i+=1)

i will never be great than multiplesOfEight.length since i equal to 0, so you should put i less than multiplesOfEight.length

for (i = 0; i<multiplesOfEight.length; i+=1)