-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathep3.js
More file actions
44 lines (43 loc) · 816 Bytes
/
ep3.js
File metadata and controls
44 lines (43 loc) · 816 Bytes
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
console.log("Starting of ep3");
console.log("---------------");
//For LOOP
for (let i = 1; i <= 2; i++) {
console.log("count =", i);
}
let sum = 0;
let n = 7 // prompt("Enter your no. here:")
for (let i= 1 ; i <= n ; i++){
sum = sum + i
}
console.log("Your answer is :",sum)
//WHILE LOOP
let l = 1;
while (l<=5){
console.log("Hey",l)
l++
}
//DO WHILE LOOP
let i = 1;
do {
console.log("i=", i);
i++
} while (i<=5);
//FOR-OF LOOP
let str = "heyYoo";
let size = 0;
for(let val of str){
console.log ("val=",val)
size++
}
console.log("Size of string is =", size)
//FOR-IN LOOP
let student = {
name: "Anshul Singh Chauhan",
age: 19,
cgpa: 7.5,
isPass: true
};
for (let key in student) {
console.log(key)
}
console.log("heyyy heyy");