Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

loops javascript

let i = 0;
//while checking for a state
while (i < 20){
  console.log(`do something while ${i} is less than 20`)
i++;
}
console.log("End of While Loop")
//for iterating a certain number of times
for(j = 0; j < 20; j++){
  console.log(`do something for ${j + 1} time(s)`)
}
console.log("End of For loop")
Source by www.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #loops #javascript
ADD COMMENT
Topic
Name
5+2 =