javascript array method sort returns 120 larger than 50
<p>the following code sorts the integers in the array wrong in which it the result is: 1,10,100,30,40,50,80</p>

<pre><code>var arr = new Array();

arr = [50,100,30,40,80,10,1];

var z = arr.sort();

console.error(z);
</code></pre>