<html> <head> <title>Array literal</title> <script type="text/javascript" > function compare(a, b) { return a - b; } var gravities = [0.8, 0.1, 1, 0.3, 2.4]; gravities.sort(compare); document.write(gravities); </script> </head> <body> </body> </html>