Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

for loop in javacript

//first type
for(let i; i< number; i++){
  //do stuff
  //you can break
  break
}

//2nd type
const colors = ["red","green","blue","primary colors"]

colors.forEach((color) =>{
 //do stuff 
 //But you can't breack out of the loop
})

//3rd type might not be considered as a loop
  colors.map((color) =>{//do stuff
  //no bracking})
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #loop #javacript
ADD COMMENT
Topic
Name
1+6 =