-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoop.js
More file actions
73 lines (54 loc) · 1.18 KB
/
Loop.js
File metadata and controls
73 lines (54 loc) · 1.18 KB
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
66
67
68
69
70
71
72
73
// for(let i=1;i<=100;i++){
// console.log("JavaScript")
// }
// console.log("loop has Ended")
//Sum Of Number From 1 to n
/*let n=prompt("Enter a Number : ")
let sum=0;
for(let i=1;i<=n;i++){
sum=sum+i;
}
console.log(sum);
console.log("loop has Ended")
*/
/*for(let i=1;i<=10;i++){
console.log("i="+i)
}
console.log("loop has Ended")*/
/*let i=1;
while(i<=5){
console.log("While Loop");
i++;
}*/
//For-Of-Loop
/*let str="Javascript"
let len=0;
for (let i of str) {
console.log("i= "+i);
len++;
}
console.log("The Length Of The String is : "+len);*/
/*for-in-Loop
let student={
name:"Rashmi Ranjan",
age:21,
rollno:94,
cgpa:8.9,
ispass:true
};
for(let i in student ){
console.log("Key="+i+" : Value="+student[i]);
}*/
/*Printing All The Even number From 1 to 100
for(let i=0;i<=100;i++){
if(i%2==0){
console.log("Even Number = "+i);
}
}*/
/*Game Number
let guessnumber=prompt("Guess Number");
let gameNumber=25;
while(guessnumber!=gameNumber){
guessnumber=prompt("You Entered Wrong Number Please Again Guess");
}
console.log("You Entered The Right number");*/