-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path06_conditional_expression.js
More file actions
50 lines (42 loc) · 899 Bytes
/
Copy path06_conditional_expression.js
File metadata and controls
50 lines (42 loc) · 899 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
45
46
47
48
49
let a = prompt("hey whats you age?")
a=Number.parseInt(a) //Converting string to num
console.log(typeof a)
if (a<0){
alert("This is not valid age");
}
else if (a<9){
alert("baccha u are kid You cannot even think of drive");
}
else if (a<18 && a>=9){
alert("You are kid you can drive when you become 18 year old ");
}
else{
alert("You can drive as you are above 18 ");
}
// Switch case statement
let station = prompt("Enter station Number:-");
switch (station) {
case '1':
console.log("Bhavanagar");
break;
case '2':
console.log("Shihor");
break;
case '3':
console.log("Lathi");
break;
case '4':
console.log("Botad");
break;
case '5':
console.log("Ranpur");
break;
case '6':
console.log("Limbadi");
break;
case '7':
console.log("Surendranagar");
break;
default:
console.log("Plz enter valid Station.");
}