-
Notifications
You must be signed in to change notification settings - Fork 0
/
html51.html
65 lines (49 loc) · 1.28 KB
/
html51.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!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">
<title>Loops in JavaScript</title>
</head>
<body>
<div class="container">
This is tutorial about the loops in JavaScript.
</div>
<script>
// Loops are same as C and java
// let i=0;
// for(i=0;i<=10;i++){
// console.log(i);
// }
let friends = ["lakshay","Rahul","Mohan"];
// for(let i=0;i<friends.length;i++){
// console.log(friends[i]);
// }
// friends.forEach(function f(element){
// console.log("Hello Friend "+element);
// })
// for(element of friends){
// console.log("New Method of For loop"+ element);
// }
// let person = {
// name:"lakshay",
// age:19,
// address:"virat nagar",
// }
// for(key in person){
// console.log(`The ${key} of person is ${person[key]} `)
// }
let i=0;
while(i<4){
console.log(`${i} Inside the while loop`);
i++;
}
let j=0;
do{
console.log(`${j} Inside the do while loop`);
j++;
}while(j<4);
</script>
</body>
</html>