Skip to content

Instantly share code, notes, and snippets.

@ross-u
Last active February 13, 2024 23:41
Show Gist options
  • Save ross-u/25bd96774ec26e5932572f2389e411e3 to your computer and use it in GitHub Desktop.
Save ross-u/25bd96774ec26e5932572f2389e411e3 to your computer and use it in GitHub Desktop.
JS | Conditionals and Loops - 0 to 30 Exercise

JS | Conditionals and Loops

0 to 30 - Exercise

Let’s do a quick exercise to put into practice the new stuff we have just learned about the conditionals and loops.


Task 1 - Create a script that counts from 0 to 30.

Expected output:

0

1

2

3

28

29

30

while() {

}

Task 2 - Change the previous script to write “ten” when the value of i is 10, and “twenty” when the value if 20.

Expected output:

0

1

9

ten

11

19

twenty

21

30

while() {

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment