I have the following array. How can I sort it properly? I tried the following:
var array = ["1000:2", "101:234", "102", "101:11", "11", "12"];
array.sort(function(a, b) {
return a.localeCompare(b)
})
console.log(array)
But its not giving the correct output. After sorting it should produce: 11, 12, 101:11, 101:234, 102, 1000:2. Thank you in advance!