Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

for loop condition javascript

//this is an array of number
let array = [00,10,20,30,40,50,60,70,80,90,100]

//for loop with if condition
for (let i = 0; i < array.length; i++) {
  
if(array[i] >= 50){
    
    console.log("with condition:" + array[i] )
  }
  

}

//for loop without if condition
for (let i = 0; i < array.length; i++) {

  // Template literals
  console.log(`without condition: ${array[i]}`)
    
    
  
  }

 
PREVIOUS NEXT
Tagged: #loop #condition #javascript
ADD COMMENT
Topic
Name
1+5 =