Closed crazy4groovy closed 4 years ago
el.array.sort((a, b) => a > b) should be: el.array.sort((a, b) => a - b)
el.array.sort((a, b) => a > b)
el.array.sort((a, b) => a - b)
It's OK when I test with:
var z = el.array.sort((a, b) => a - b) console.log(z[2], z[3], z[4]) // OK
But not:
var z = el.array.sort((a, b) => a > b) console.log(z[2], z[3], z[4]) // Nope, eg => 1670 2056 1425
@crazy4groovy nice catch, whoops! Want to file a PR to fix it?
el.array.sort((a, b) => a > b)
should be:el.array.sort((a, b) => a - b)
It's OK when I test with:
But not: