-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
350 lines (249 loc) · 8.17 KB
/
app.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
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
//==== Chapter 1 , Task 1
//alert("Hello World")
//==== Chapter 1 , Task 2
//alert("Error ! Please Enter a valid Password")
//==== Chapter 1 , Task 3
//alert("Welcome to JS Land...\n Happy Coding")
//==== Chapter 1 , Task 4
//alert("Welcome to JS Land...")
//alert("Happy Coding")
//==== Chapter 1 , Task 5&6
{/* <input type="button" id="button" value="Button">
button.onclick = function() {
alert(' Hello...I can run JS through my Web Browser Console');
};
*/}
//==== Chapter 1 , Task 7
{/*
document.getElementById("demo").innerHTML = "Hello JavaScript!";
*/}
//==== Chapter 2 , Task 1
//var username
//==== Chapter 2 , Task 2
// var myName
// myName="Muhmmad ANAS "
//==== Chapter 2 , Task 3
// var message
// message="Hello World"
// alert(message)
//==== Chapter 2 , Task 4
// var name
// var age
// var course
// name="Jhone Doe"
// age="15 years old"
// course="Certified Mobile Application Development"
// alert(name)
// alert(age)
// alert(course)
//==== Chapter 2 , Task 5
// x="PIZZA\nPIZZ\nPIZ\nPI\nP"
// alert(x)
//==== Chapter 2 , Task 6
// var email="anassiddiqui"
// alert("My email address is "+" "+ email)
//==== Chapter 2 , Task 7
// var book="A smarter way to learn JavaScript"
// alert("I am trying to learn from the book "+book )
//==== Chapter 2 , Task 8
//Yayy! I can wrie HTML content through JavaScript
//==== Chapter 2 , Task 9
// var symbol="▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬"
// alert(symbol)
//==== Chapter 3 , Task 1
// var age = 18
// alert("I am "+ age +" years old.")
//==== Chapter 3 , Task 2
// var visit = 1
// var numberofvisits = visit + 1
// alert("You Have visited this site "+numberofvisits+" times")
// visit = visit + 1
//==== Chapter 3 , Task 3
// var birthyear = 2001
// alert("My birth year is " + birthyear+ "\nData type of my declared variacle is number ")
//==== Chapter 3 , Task 4
// var Visitorsname ,Producttitle,Quantity
// alert(Visitorsname +" ordered " + Quantity + " T-shirt(s) on XYZ Clothing store")
//==== Chapter 5 , Task 12
//No Solution
//=== chapter 6 task 1
// var a = 10;
// document.write("Result \n" );
// document.write("the value of a is " , a );
// document.write("---------------" );
// document.write("the value of ++a is " , ++a );
// document.write("now the value of a++ is " , a++ );
// document.write("the value of a++ is " , a++ );
// document.write("nowthe value of a++ is " , a++ );
// document.write("the value of --a is " , --a );
// document.write("now the value of --a is " , --a );
// document.write("the value of a-- is " , a-- );
// document.write("now the value of a-- is " , a-- );
//=== chapter 6 task 2
// var a=2 ;
// var b=1;
// var result = --a - --b + ++b + b--;
// document.write (result);
// document.write(--a);
// document.write(--a - --b);
// document.write(--a - --b + ++b);
// document.write(--a - --b + ++b + b--);
//=== chapter 6 task 3
//var name = prompt(" please enter your name");
//document.write("welcome "+ name );
//=== chapter 6 task 4,5
//var num = prompt(" please enter a number);
//var count ;
//for(count=0;count <10 ; count++ ){
// document.write(num + " * " + num + " = " + num*num );
// document.write("<br />")
//}
//chapter 6-9 task 6,7
// var subject1=prompt("enter the name of subject 1 ");
// var subject2=prompt("enter the name of subject 2 ");
// var subject3=prompt("enter the name of subject 3 ");
// var totalmark=100;
// var subject1marks=prompt("enter the marks of subject 1 ");
// var subject2marks=prompt("enter the marks of subject 2 ");
// var subject3marks=prompt("enter the marks of subject 3 ");
// document.write("Subject total obtained percentage ");
// document.write("<br>");
// document.write(subject1 + " " + totalmark + " " + subject1marks + " "+ (subject1marks / totalmark )* 100);
// document.write("<br>");
// document.write(subject2 + " " + totalmark + " " + subject2marks + " "+ (subject2marks / totalmark )* 100);
// document.write("<br>");
// document.write(subject3 + " " + totalmark + " " + subject3marks + " "+ (subject3marks / totalmark )* 100);
//chapter 9-10 task 1
// var city = prompt(" please enter city name");
// if (city.toLowerCase === "karachi");
// {
// document.write( "Welcome to city of lights");
// }
//chapter 9-10 task 2
// var gender = prompt(" please enter your gender ");
// if (gender.toLowerCase === "male")
// {
// document.write( "good morning sir ");
// }
// else if (gender.toLowerCase === "female" )
// {
// document.write( "good morning maam ");
// }
//chapter 9-10 task 3
// var color = prompt(" please enter color");
// if (color == "red")
// {
// document.write( "must stop");
// }
// else if (color == "yellow")
// {
// document.write( "Ready to move ");
// }
// else if (color == "green")
// {
// document.write( "Move now");
// }
// var color = prompt(" please enter color");
//chapter 9-10 task 4
// var fuel = prompt(" please enter remaining feul in liters");
// if (fuel < "0.25")
// {
// document.write( "Please refill the fuel in your car");
// }else document.write("Continue")
//chapter 9-10 task 5
// a) Displayed
// b) Not Displayed
// c) Displayed
// d) Not Displayed
// e) Displayed
// f) Displayed
// var TMark= prompt("Plese Enter Your Total Marks");
// var Mark= prompt("Plese Enter Your Marks Obtained");
// Marks= Mark*100/TMark
// if (Marks > 79)
// {
// document.write( "MarkSheet\n"+"\n Total Marks :"+TMark+ " \n Marks Obtained: "+Mark+ " Percentage: " + Marks + " Grade:A-one");
// }else if (Marks > 69)
// {
// document.write("MarkSheet\n"+"\n Total Marks :"+TMark+ " \n Marks Obtained: "+Mark+ " Percentage: " + Marks + " Grade:A");
// }else if (Marks > 59)
// {
// document.write("MarkSheet\n"+"\n Total Marks :"+TMark+ " \n Marks Obtained: "+Mark+ " Percentage: " + Marks + " Grade:B");
// }else if (Marks < 60 )
// {
// document.write( "MarkSheet\n"+"\n Total Marks :"+TMark+ " \n Marks Obtained: "+Mark+ " Percentage: " + Marks +" Grade:Fail");
// }
//chapter 11-13 task 2
// var n= prompt("Plese Enter number 1");
// var m= prompt("Plese Enter number 2");
// if(n>m){
// document.write(n + "is larger");
// }
// else if(n<m){
// document.write(m + "is larger");
// }
// else{
// document.write("equal");
// }
//chapter 11-13 task 3
// var n= prompt("Plese Enter number 1");
// if(n>0){
// document.write(n + "is psitive");
// }
// else if(n<0){
// document.write(m + "is negative");
// }
// else{
// document.write("zero");
// }
//chapter 11-13 task 4
// var n= prompt("Plese Enter letter");
// if(n== "u" ||n== "a" ||n== "e" ||n== "i" ||n== "o" ){
// document.write("true");
// }
// else{
// document.write("false");
// }
//chapter 11-13 task 6
// var hour = 13;
// if (hour < 18) {
// greeting = "Good day";
// }
// else{
// greeting = "Good evening";
// }
//chapter 13-16 task 1-9
// var name= [];
// var cars = [ "Volvo", "BMW"];
// var n = [1,2,4,3];
// var x = [true,false];
// var fas = [1,"Saab", 2,"Volvo", "BMW"];
// var qualification=["SSC", "HSC", "BCS",
// "BS", "BCOM", "MS"," M. Phil," "PhD"];
// for(var c=0;c<8;c++){
// document.write(c+ ") "qualification[c] );
// document.write("<br>");
// }
// //chapter 17-20 task 1-3
// var activities = [];
// var num = [0, 1,2,3],
// [1, 0,1,2],
// [2,1,0,1],
// ];
//chapter 17-20 task 3
// var c =0;
// for(c=1;c<=10 ;c++){
// document.write(c);
// document.write("<br>");
// }
//chapter 17-20 task 4
//var num = prompt(" please enter a number);
//var x = prompt(" please enterlenth of table);
//var count ;
//for(count=1;count <=x ; count++ ){
// document.write(num + " * " + count + " = " + num*count );
// document.write("<br />")
//}
//chapter 17-20 task 5
// fruits = [“apple”, “banana”, “mango”, “orange”,
// “strawberry”]