I have an array having values are 1,10,6,8,7 and I want to sort this using sort()
method, It's giving result like this 1,10,6,7,8 rather than 1,6,7,8,10
I wrote code below :
var arr = [1,10,6,8,7];
arr.sort();
document.write(arr);
Can anyone have idea about this?