-
Notifications
You must be signed in to change notification settings - Fork 0
/
lecture_12.js
47 lines (29 loc) · 882 Bytes
/
lecture_12.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
// // .......................................Questions of CHAPTER 3........................................................
const marks = {
suraj: 98,
Rohan: 67,
Mohan: 78,
harry: 89,
};
// //problem 1
for(let i=0 ; i<Object.keys(marks).length;i++){
console.log("The marks of " + Object.keys(marks)[i] + "are" + marks[Object.key(marks)[i]])
}
// //problem 2 using for in loop
// for (let key in marks) {
// console.log("marks of " + key + " is " + marks[key]); // key
// }
// // Problem 3
// let a = 42;
// let n;
// while (n != a) {
// n = prompt("Enter a lucky no");
// console.log("try again"); // prompt run in chrome here it gives error
// }
// console.log("Enter a right no");
// // problem 4 avg of 5 no using function
// function avg(a,b,c,d,e) {
// return (a+b+c+d+e)/5;
// }
// g = avg(1,2,3,4,5);
// console.log(g);