for-satser

status: alpha
author: krm
created: 2026-05-27

1. 🪧 Count to ...

let max = Number(prompt("Count to?"));
for(let i = 0; i < max; i++) {
  console.log(i);
}

1. 🐾 Test 1

> 1

2. 🐾 Test 2

> 3



2. 🪧 Count down to ...

let max = Number(prompt("Count down to?"));
for(let i = max; i > 0; i=i-1) {
  console.log(i);
}

1. 🐾 Test 1

> 1

2. 🐾 Test 2

> 3



3. 🪧 Count with steps ...

let max = Number(prompt("Count to?"));
for(let i = 1; i < max; i=i+2) {
  console.log(i);
}

1. 🐾 Test 1

> 4


2. 🐾 Test 2

> 7



4. 🪧 Count with steps and stuff ...

let max = Number(prompt("Count to?"));
for(let i = 2; i < max; i=i+3) {
  console.log(i*2);
}

1. 🐾 Test 1

> 3

2. 🐾 Test 2

> 9