-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfor_of.js
More file actions
26 lines (23 loc) · 879 Bytes
/
Copy pathfor_of.js
File metadata and controls
26 lines (23 loc) · 879 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
function showStudents() {
var students = new Array("Heba", "Rikesh", "Moiz", "Ali");
document.write("<br />Number of students " + students.length + "<br />");
document.write("<H1 class='student'>Students list </h1>");
displayTable(students);
document.write("<H1 class='student'>Students list sorted</h1>");
students.sort();
displayTable(students);
document.write("<H1 class='student'>Students list in reverse order</h1>");
students.reverse();
displayTable(students);
document.write("<H1 class='student'>Students list except last one</h1>");
students.pop();
displayTable(students);
document.write("<H1 class='student'>Students list with a new one</h1>");
students.push("Rawdha");
displayTable(students);
}
function displayTable(tab) {
for (student of tab) {
document.write(student + "<br />");
}
}