Introduction to `For` Loops


#1

What am I doing wrong?

// Change this code such that it starts counting from 10.
// We want it to stop once it gets to 0.
// We want it to count down by 1.
// In the end, the numbers 10..0 inclusive, should be printed.

for (var i = 10; i >= 0; i =- 1) {
	console.log(i);
}

https://www.codecademy.com/courses/javascript-beginner-en-NhsaT/1/2?curriculum_id=506324b3a7dffd00020bf661#


#2

here:

i =- 1

if we want to reduce i by one we can do:

i = i - 1

or we can use the shorthand:

i -= 1

which i think you try to use, except you swapped - and = around


#3

THANKS - that worked!


#4