Javascript examples for Array:sort
Array sort() with concat()
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from w w w . j av a 2 s .c o m function myFunction() { var hege = [34, 12,3,4,5,6,7,6,5,4,3,33,3,4,5,6,6,76]; var stale = [1, 78, 8, 4]; var children = hege.concat(stale).sort(function(a,b){return a - b}) document.getElementById("demo").innerHTML = children ; } myFunction(); } </script> </head> <body> <div id="demo"> hi </div> </body> </html>