Thursday, August 1, 2013

JavaScript arraysort Number_02

<html>
<body>

<script type="text/javascript">

function sortNumber(a, b)
{
return b - a;
}

var n = ["10", "5", "40", "25", "100", "1"];
document.write(n.sort(sortNumber));

</script>

</body>
</html>
Result

No comments: