HEADER ADS 728X90

how to use loop in javascript | While, do while, for loop | what is loop? | JS Tutorial: 12 | By CP

css,html,php,javascript,tutorial,code prime,foreach loop in javascript,while loop in javascript,for loop javascript array,infinite loop in javascript,for loop in javascript with index,how to count for loop in javascript,nested loop in javascript codeprime,event loop in javascript codeprime,Loop uses in javascript,While,do while,for loop,what is loop?,online tutorial,easy tutorial,online degree,technology,javascript tutorial for beginners,javascript full course,codeprime, coding tutorial, how to learn coding easy way to learn coding

Hi dear welcome to "CodePrime" Blog . In this post You are going to learn Loop uses in javascript | While, do while, for loop | what is loop? | JS Tutorial | By CP. First Creat A index.html file Copy This HTML CODE and pest it one your code editor. 2ndly creat loop.js file Then Copy The JS CODE and pest it then open the index.html file with your browser.

HTML CODE

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="/js/loop.js"></script>
    <title>javascript</title>
</head>
<body>
    <h2>Javascript Tutorial</h2>
    <h3>By Codeprime</h3>
   
</body>
</html>

JAVASCRIPT CODE

let i=0; //UNIVERSAL VARIABLE

//while example

while(i<5) {
    console.log("The Number is" +i);
    i++;
};

//do-while example

do{
    console.log("The Number is" +i);
      i++;
}

while(i>5);

//for loop example

for( i=0;i<5;i++) {
    console.log("the number is " +i)
}

//repeating loop
for( i=0;i<100;i++) {
    console.log(i+ "Code prime");
}

Youtube Tutorial

FLOW US ON SOCIAL MEDIA

Post a Comment

0 Comments

Join Telegram