NA +91-8727899942 thecoderjob@gmail.com

CHAPTER - 6

What is the loops in javascript

Loops in JavaScript allow you to execute a block of code multiple times.

There are mainly three types of loops in JavaScript: for, while, and do-while

Here's is the Code !!

//for loop
for (let i = 0; i < 5; i++) {
  console.log(i);
}

//while loop
let i = 0;
while (i < 5) {
  console.log(i);
  i++;
}

// do while loop
let i = 0;
do {
  console.log(i);
  i++;
} while (i < 5);

//Loop control statements
for (let i = 0; i < 5; i++) {
  if (i === 2) {
    continue; // Skip the current iteration
  }
  if (i === 4) {
    break; // Exit the loop
  }
  console.log(i);
}

Chapter 5

What is control flow in javascript.

Previous chapter

Chapter 7

Writing first Node Js program with express framework.

Next chapter

Get In Touch

NA

thecoderjob@gmail.com

+91-8727899942

Popular Links

© www.thecoderjob.com. All Rights Reserved.               Designed by HTML Codex