Javascript for loop


  • for - loops through a block of code a number of times
A for loop repeats until a specified condition evaluates to false. The JavaScript for loop is similar to the Java and C for loop. A for statement looks as follows: for (initialization; condition; afterthought) statement.



Snytax:
for(initializaion; condtion ; inc/dec){
Statement
}

Example:


for(let num = 1 ; num<=5; num++){
  console.log("*******");
  console.log("Hello Seema");
}

Comments

Popular posts from this blog

Javascript Array Concat and Join Method

JavaScript While Loop

JavaScript pop() Method