Final
This commit is contained in:
RobinNixon
2020-12-10 13:51:13 +00:00
parent 3aeeb4477e
commit 53063593e3
1127 changed files with 0 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
<script>
// Alphabetical sort
sports = ["Football", "Tennis", "Baseball", "Hockey"]
sports.sort()
document.write(sports + "<br>")
// Reverse alphabetical sort
sports = ["Football", "Tennis", "Baseball", "Hockey"]
sports.sort().reverse()
document.write(sports + "<br>")
// Ascending numeric sort
numbers = [7, 23, 6, 74]
numbers.sort(function(a,b){return a - b})
document.write(numbers + "<br>")
// Descending numeric sort
numbers = [7, 23, 6, 74]
numbers.sort(function(a,b){return b - a})
document.write(numbers + "<br>")
</script>