Prev Demo
Lowest Value Sorting
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <h1>Lowest value sorting</h1> <p>Click the button to sort an array in for lowest value.</p> <button onclick="myFunction()">Click</button> <p id="myId"></p> <script> var a = [85, 52, 56, 98, 74, 32, 5, 9, 99]; document.getElementById("myId").innerHTML = a; function myFunction() { a.sort(function (a, b) { return a - b }); document.getElementById("myId").innerHTML = a[0]; } </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output