-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharrayExample.html
More file actions
34 lines (29 loc) · 1.15 KB
/
Copy patharrayExample.html
File metadata and controls
34 lines (29 loc) · 1.15 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
<html>
<head>
<title>Array example</title>
</head>
<body>
<p id="arr"></p>
<script>
var cars = ["BMW","Volvo","Honda","Mycar","yourCar"];
document.getElementById("arr").innerHTML = cars;
document.getElementById('arr').innerHTML = cars.toString();
document.getElementById('arr').innerHTML = cars.join(" - ")
document.getElementById('arr').innerHTML = cars.shift();
document.getElementById('arr').innerHTML = cars;
document.getElementById('arr').innerHTML = cars.shift();
document.getElementById('arr').innerHTML = cars;
cars.unshift("Maruti")
document.getElementById('arr').innerHTML = cars;
</script>
<h2>Java Script array sorting</h2>
<p The lowest number is:></p> <span id='lowsernumber'></span></p>
<script>
var myArray = [10,45,98,351,654,1,366,54]
document.getElementById('lowsernumber').innerHTML = myFunction(myArray);
function myFunction(arr){
return Math.min.apply(null,arr)
}
</script>
</body>
</html>