for-satser

status: alpha
author: krm
created: 2026-06-08

Om inget värde skriv ut, så svara med bara "none".

1. 🪧 Count every second to ...

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

1. 🐾 Test 1

> 3



2. 🐾 Test 2

> 10







2. 🪧 Count down to ...

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

1. 🐾 Test 1

> -1




2. 🐾 Test 2

> -5





3. 🪧 Count with half steps ...

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

1. 🐾 Test 1

> 4




2. 🐾 Test 2

> 0


4. 🪧 Count down with steps and stuff ...

let min = Number(prompt("Count to?"));
for(let i = -7; i > min; i=i-3) {
  console.log(i*2+1);
}

1. 🐾 Test 1

> -10


2. 🐾 Test 2

> -15