- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask3.js
More file actions
Latest commit
88 lines (61 loc) · 3.51 KB
/
Copy pathTask3.js
File metadata and controls
88 lines (61 loc) · 3.51 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
letstudentNames=[]
letstudents=newArray()
letstring_array=['mudassir','hadi']
letnumber_array=[10,20]
letboolean_array=[true,false]
letmixed_array=['mudassir',20,true]
letqualifications=[' 1) SSC <br>'+'2) HSC <br>'+'3) BCS <br>'+'4) BS <br>'+'5) BCOM <br>'+'6) MS <br>'+'7) M. Phil. <br>'+'8) PhD <br>']
document.write('<font size=5> Qualifications: <br> <br>'+qualifications+'<br> <br>')
letstudents_Names=['Michael','John','Tony']
letstudents_scores=[320,230,480]
document.write('Score of '+students_Names[0]+' '+'is '+students_scores[0]+'.'+'Percentage is '+students_scores[0]/500*100+'% <br>')
document.write('Score of '+students_Names[1]+' '+'is '+students_scores[1]+'.'+'Percentage is '+students_scores[1]/500*100+'% <br>')
document.write('Score of '+students_Names[2]+' '+'is '+students_scores[2]+'.'+'Percentage is '+students_scores[2]/500*100+'% <br> <br>')
letcolor=['red','green']
letcolor_asking=prompt('Enter any color you want to add in the beginning')
letcolor_asking2=prompt('Enter any color you want to add in the end')
color.unshift(color_asking)
document.write('Adding user color in the beginning of the array:'+color+'<br>')
color.push(color_asking2)
document.write('Adding user color in the end of the array:'+color+'<br>')
color.unshift('blue','pink')
document.write('Adding two color in the beginning of the array:'+color+'<br>')
color.shift()
document.write('Deleting the first color in the array:'+color+'<br>')
color.pop()
document.write('Deleting the last color in the array:'+color+'<br>')
letindex_asking=prompt('Enter at what position/index you want to add the color')
letcolor_asking_name=prompt('Enter the color name you want to add at '+index_asking+' position')
color[index_asking]=[color_asking_name]
document.write('Adding color at specific index by asking user:'+color+'<br>')
letcolor_count=prompt('How many colors you want to delete')
for(letindex=0;index<color_count;index++){
letindex_asking2=prompt('Enter at what position/index you want to delete the color')
color[index_asking2]=[]
document.write('Deleting color at specific index by asking user:'+color)
}
letnumbers=[320,230,480,120]
document.write('Scores of Students : '+numbers+'<br>')
numbers.sort(function(a,b){
returna-b;
});
document.write('Ordered Scores of Students : '+numbers,'<br> <br>');
document.write('Cities list: <br>')
letcities=['Karachi','Lahore','Islamabad','Quetta','Peshawar <br> <br>']
document.write(cities)
document.write('Selected cities list <br>')
letselectedCities=['Islamabad','Quetta','Peshawar <br> <br>']
document.write(selectedCities)
vararr=['This','is','my','cat'];
document.write('Array: <br> '+arr+'<br> <br>')
varjoining_arr=arr.join(' ');
document.write('Array: <br> '+joining_arr+'<br> <br>')
letdevices=['keyboard','mouse','printer','moniter']
document.write('Devices: <br>'+devices+'<br>')
document.write(devices+'<br> <br>')
letdevices2=['keyboard','mouse','printer','moniter']
document.write('Devices: <br>'+devices+'<br>')
letdevices_reverse=devices2.reverse();
document.write(devices_reverse+'<br> <br>')
letphone_manufacturers=['Apple <br>'+'Samsung <br>'+'Motorola <br>'+'Nokia <br>'+'Sony <br>'+'Haier <br>']
document.write(phone_manufacturers)