While loop


#1

https://www.codecademy.com/courses/javascript-beginner-en-qDwp0/0/3?curriculum_id=506324b3a7dffd00020bf661

Why does the while loop print ‘18’?

for (i=0; i<=15; i+=3) {//this is a counter which increments by +3
    console.log(i);
    }

var i = 0;
while (i<=15) {
    console.log(i);
    i+=3;
    }

#2

It is the Javascript interpreter which is running in this course-environment,
it display’s the last non-displayed action…

You will also encounter this, when you are doing a return-statement
as last action…
You could counter this by using a
console.log( " " ); as last statement…

In some sections of this course, the course-checker Display’s data
this you could then identify by placing two EXTRA code-line’s:
console.log( “== My End ==” );
console.log( “== All that is displayed now, is the course-checker ==” );


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.