Skip to content

Commit cc5876d

Browse files
committed
switch
1 parent d7accf6 commit cc5876d

File tree

5 files changed

+229
-2
lines changed

5 files changed

+229
-2
lines changed

If_Else/app.js

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
// if(condition){
2+
// result
3+
// }
4+
5+
// var age = +prompt("write your age")
6+
// if (age >= 18){
7+
// console.log("admission hogaya");
8+
// document.write("admission hogaya")
9+
// }
10+
// else{
11+
// console.log("admission nhi hua")
12+
// document.write("<h1>admission nhi hogaya</h1>")
13+
// }
14+
// if html && css quiz number > 150 so you are eligible else not
15+
16+
// var html = +prompt("write your html numbers")
17+
// var css = +prompt("write your css numbers")
18+
// var result = html + css
19+
// console.log(result);
20+
// if(result >=150){
21+
// console.log("pass");
22+
// }
23+
// else{
24+
// console.log("fail");
25+
// }
26+
27+
// Write a JavaScript program that accept two integers and
28+
// display the larger. Also show if the two integers are equal.
29+
30+
31+
// var num1 = +prompt("enter your 1st integer");
32+
// var num2 = +prompt("enter your 2nd integer");
33+
34+
// if(num1 > num2){
35+
// console.log(num1 + " is greater then " + num2);
36+
// }
37+
38+
// else{
39+
// console.log(num2 + " is greater then " + num1);
40+
// }
41+
42+
// Write a program that takes input a number from user &
43+
// state whether the number is positive, negative or zero.
44+
45+
// var num = +prompt("Enter Your Number")
46+
47+
// if (num > 0){
48+
// console.log("positive");
49+
// }
50+
// else if (num === 0){
51+
// console.log("neutral");
52+
// }
53+
// else{
54+
// console.log("negative");
55+
// }
56+
// var num1 = +prompt("enter 1st number")
57+
// var num2 = +prompt("enter 2nd number")
58+
// var operator = prompt("enter your operator", '+ - * /')
59+
// var result;
60+
// if(operator == "+"){
61+
// result = num1 + num2
62+
// console.log(result);
63+
// }else if (operator == "-"){
64+
// result = num1 - num2
65+
// console.log(result);
66+
// }else if (operator == "*"){
67+
// result = num1 * num2
68+
// console.log(result);
69+
// }else if (operator == "/"){
70+
// result = num1 / num2
71+
// console.log(result);
72+
// }else{
73+
// alert("your operator does not exist")
74+
// }
75+
76+
// Comparison operators
77+
//==
78+
//===
79+
//!=
80+
//!==
81+
//>
82+
//<
83+
// &&
84+
// ||
85+
86+
var number = 20
87+
// if (number == '20'){
88+
// console.log("equal");
89+
// }
90+
// else{
91+
// console.log("not equal");
92+
// }
93+
if (number != 30) {
94+
console.log(" equal")
95+
}
96+
else {
97+
console.log("notequal");
98+
}
99+
100+
// if & else if
101+
// var age = +prompt("enter age")
102+
// var clas = +prompt("enter time")
103+
// if (age > 8 && clas < 3 ) {
104+
// alert("Come to our school!");
105+
// }
106+
// else {
107+
// alert("dont Come to our school!");
108+
// }
109+
// var weight = +prompt("enter weight")
110+
// var time = +prompt("enter time")
111+
// if (weight > 300 || time < 6) {
112+
// alert("Come to our tryout!");
113+
// }
114+
// else {
115+
// alert("Come to our cookout!");
116+
// }
117+
118+
119+
// var password = "smit";
120+
// var userinput = prompt("type yor input")
121+
// console.log(userinput);
122+
// if (password == userinput){
123+
// console.log("password is correct");
124+
// }
125+
// else{
126+
// console.log("password is not correct");
127+
// }
128+
129+
// nested if else
130+
131+
// var dinner = prompt("what do you want in dinner")
132+
// console.log(dinner);
133+
if (dinner == 'biryani' || dinner == 'tikka' || dinner == 'pizza') {
134+
console.log("it is Available")
135+
136+
// nested
137+
if (dinner == "biryani") {
138+
alert("biryani price : 300")
139+
}
140+
else if (dinner == "tikka"){
141+
alert("tikka price : 500")
142+
}
143+
else{
144+
alert("pizza price : 1000")
145+
}
146+
}
147+
else {
148+
console.log("it is not availabe")
149+
}

If_Else/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>If Else</title>
7+
</head>
8+
<body>
9+
<h1 style="text-align: center;">If Else</h1>
10+
<script src="app.js"></script>
11+
</body>
12+
</html>

Index.html

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,32 @@ <h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white"
8888
</a>
8989
</div>
9090
<div class="max-w-sm p-6 bg-white border border-gray-200 rounded-lg shadow-sm dark:bg-gray-800 dark:border-gray-700">
91+
<a href="#">
92+
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">If Else</h5>
93+
</a>
94+
<p class="mb-3 font-normal text-gray-700 dark:text-gray-400">Here are the biggest enterprise technology acquisitions of 2021 so far, in reverse chronological order.</p>
95+
<a href="If_Else/index.html" class="inline-flex items-center px-3 py-2 text-sm font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
96+
Read more
97+
<svg class="rtl:rotate-180 w-3.5 h-3.5 ms-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 10">
98+
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 5h12m0 0L9 1m4 4L9 9"/>
99+
</svg>
100+
</a>
101+
</div>
102+
<div class="max-w-sm p-6 bg-white border border-gray-200 rounded-lg shadow-sm dark:bg-gray-800 dark:border-gray-700">
103+
<a href="#">
104+
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">Switch Case</h5>
105+
</a>
106+
<p class="mb-3 font-normal text-gray-700 dark:text-gray-400">Here are the biggest enterprise technology acquisitions of 2021 so far, in reverse chronological order.</p>
107+
<a href="Switch/index.html" class="inline-flex items-center px-3 py-2 text-sm font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
108+
Read more
109+
<svg class="rtl:rotate-180 w-3.5 h-3.5 ms-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 10">
110+
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 5h12m0 0L9 1m4 4L9 9"/>
111+
</svg>
112+
</a>
113+
</div>
114+
</div>
115+
<div class="main flex text-center mt-10">
116+
<div class="max-w-sm p-6 bg-white border border-gray-200 rounded-lg shadow-sm dark:bg-gray-800 dark:border-gray-700">
91117
<a href="#">
92118
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">Stop Watch</h5>
93119
</a>
@@ -111,8 +137,6 @@ <h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white"
111137
</svg>
112138
</a>
113139
</div>
114-
</div>
115-
<div class="main flex text-center mt-10">
116140
<div class="max-w-sm p-6 bg-white border border-gray-200 rounded-lg shadow-sm dark:bg-gray-800 dark:border-gray-700">
117141
<a href="#">
118142
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">Object</h5>

Switch/app.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
function sum(a = 0, b = 0) {
2+
var total = a + b
3+
return total
4+
}
5+
var total = sum(30, 20)
6+
7+
function showStatusMsg(status) {
8+
var msgToShow = ''
9+
switch (status) {
10+
case 'pending':
11+
msgToShow = "Your App will be reviewed soon."
12+
break;
13+
case 'approve':
14+
msgToShow = "Congrats!. Your app is approved."
15+
break;
16+
case 'review':
17+
msgToShow = "Your App is in review."
18+
break;
19+
case 'reject':
20+
msgToShow = "Your App is rejected.Plz fix the issues and submit again."
21+
break;
22+
default:
23+
msgToShow = "Your App will be reviewed soon."
24+
break;
25+
}
26+
27+
return msgToShow
28+
}
29+
30+
console.log(showStatusMsg('reject'))

Switch/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Switch</title>
7+
</head>
8+
<body>
9+
<h1 style="text-align: center;">Switch Case</h1>
10+
<script src="app.js"></script>
11+
</body>
12+
</html>

0 commit comments

Comments
 (0)