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

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 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