-
Notifications
You must be signed in to change notification settings - Fork 0
/
lecture_09.js
52 lines (37 loc) · 1015 Bytes
/
lecture_09.js
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
// //...........................................FOR_Loop..........................................................
// //......................................For_in & For_of_Loop..................................................
// for(i=0;i<=10;i++){
// console.log(i) ;
// }
// console.log(i);
// // //WAP to add first n no's
// let ans = 0
// let n;
// n=prompt("enter nth term")
// for(i=0;i<n;i++){
// ans += i;
// }
// alert(`sum of first ${n} natural no is `+ ans );
// // //WAP of factorial
// let o =4;
// let an =1;
// for(i=1;i<=o;i++){
// an = i*an;
// }
// console.log(an);
// //For in loop...............................................
let obj = {
Suraj : 99,
Vaibhav : 87,
Shiven: 85,
Aman : 83,
Viraj : 60,
}
for(let a in obj){
console.log(" Marks of "+ a +" is "+ obj[a] )
}
// For of Loop....................................................................
let names = ["Suraj","Sharma","Vimal"]
for(let name of names){
console.log(name);
}