repl.it
@MIhm7904/

SampleSet7

Nodejs

Sample Set 7: Loops

fork
loading
Files
  • index.js
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
//loops
//'for' loop needs 3 statements: 1) condition before loop starts i = 1; 2) condition to run and end loop i <= 5; 3) execution statement after each loop i++
//run loop starting at 1 and adding one each iteration until 5
// for (let i = 1; i <= 5; i++){
//   console.log(i)
// }
//'while' loop
let i = 1
while (i <= 5){
  console.log(i)
  i++
}