-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpracticeset3.js
More file actions
33 lines (30 loc) · 784 Bytes
/
practiceset3.js
File metadata and controls
33 lines (30 loc) · 784 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
//chapter 3 pravtice set
//ques 1 write a program to print the marks of a studnet un a ojbect using fo loop
let marks={
Aakriti: 99,
HArry:80,
Monika:33,
Bruh:2
}
for (let i=0; i<Object.keys(marks).length;i++){
console.log("the marks of "+ Object.keys(marks)[i] + " are "+ marks[Object.keys(marks)[i]])
}
//for in loop
//problem 2
for(let key in marks){
console.log("The marks of "+ key + " are "+marks[key])
}
//problem 3 print try again unntilcoorect number is recieved
let cn = 4 ;
let i;
while(i!=cn){
i=prompt("enter a number ")
console.log("try agarin")
}
console.log("You have netered a correct number")
//problem nu 4
//write aprogram to get a mean of 5 numbers
const mean=(a,b,c,d,e)=>{
return (a+b+c+d+e)/5
}
console.log(mean(1,3,4,56,6))