# Edit in JSFiddle

```//Numeric Array
var num = [1,55,32,23,3,2,100,3453,8,9,15,99,1546,35,29,7];

console.log(num);

//ascending order
console.log(num.sort(
function(a,b){return a-b}
));

//descending order
console.log(num.sort(
function(a,b){return b-a}
));

```
```<!-- Easy JavaScript #15 - Sorting Numeric Arrays  -->
<p>
Welcome to the 15th Easy JavaScript tutorial, part of <a href="http://www.easyprogramming.net">EasyProgramming.net</a>. Let's talk about sorting numeric values in arrays.
</p>
<p>
Sorting numeric values in arrays may give you unexpected results. The sort() method compares not just values, but the characters within the values to determine in which order the values should be listed. So the number 153 would actually be less than the number 5. It's comparing the '1' to the '5' - weird, right?
</p>
<p>
JavaScript lets you get around that by allowing you to use a compare function to determine which value is indeed lesser or greater.
</p>
<p>
Read about the compare function at the following W3schools link: <a href="http://www.w3schools.com/js/js_array_sort.asp">http://www.w3schools.com/js/js_array_sort.asp</a>
</p>```