0% found this document useful (0 votes)
41 views

Name: Chaitanya Ramdas Bhosale Roll No: 78 Enrollment No: 1815770231 Batch: 4

The document contains 6 sections that demonstrate different JavaScript looping and conditional statements including for, do-while, while, if-else, and switch-case. It provides code examples that output the value of the loop counter or conditional expression to the document.

Uploaded by

Prathmesh Gurav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Name: Chaitanya Ramdas Bhosale Roll No: 78 Enrollment No: 1815770231 Batch: 4

The document contains 6 sections that demonstrate different JavaScript looping and conditional statements including for, do-while, while, if-else, and switch-case. It provides code examples that output the value of the loop counter or conditional expression to the document.

Uploaded by

Prathmesh Gurav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Name : Chaitanya Ramdas Bhosale

Roll No : 78

Enrollment No : 1815770231

Batch : 4

<html>

<head>

<title>Document</title>

</head>

<body>

<script type="text/javascript">

var x;

// for loop begins when x=2

// and runs till x <=4

for (x = 2; x <= 4; x++) {

document.write("Value of x:" + x + "<br />");

</script>

</body>

</html>
<html>

<head>

<title>Document</title>

</head>

<body>

<script type="text/javaScript">

var languages = { first : "C", second : "Java",

third : "Python", fourth : "PHP",

fifth : "JavaScript"};

for(itr in languages)

document.write(languages[itr] + "<br>");

</script>

</body>

</html>
<html>

<head>

<title>Document</title>

</head>

<body>

<script type="text/javaScript">

// JavaScript program to illustrate do-while loop

var x = 21;

do

// The line while be printer even

// if the condition is false

document.write("Value of x:"+ x + "<br />");

x++;

} while(x < 20);

</script>

</body>

</html>
<html>

<head>

<title>Document</title>

</head>

<body>

<script type="text/javaScript">

// JavaScript program to illustrate while loop

var x = 1;

// Exit when x becomes greater than 4

while(x <= 4)

document.write("Value of x:"+ x + "<br />");

// increment the value of x for

// next iteration

x++;

</script>

</body>

</html>
<!DOCTYPE html>

<html >

<head>

<title>Document</title>

</head>

<body>

<script type="text/javaScript">

// JavaScript program to illustrate If-else statement

var i = 10;

if(i < 15)

document.write("10 is less than 15");

else

document.write("I am Not in if");

</script>

</body>

</html>
<html>

<head>

<title>Document</title>

</head>

<body>

<script type="text/javascript">

// JavaScript program to illustrate switch-case

var i = 9;

switch(i){

case 0:

document.write("i is zero.");

break;

case 1:

document.write("i is one.");

break;

case 2:

document.write("i is two.");

break;

default:

document.write("i is greater than 2.");

</script>

</body>

</html>

You might also like