samdenty/console-feed

Incorrect logs after sorting array twice

MatthewCaseres opened this issue · 0 comments

Send the following to the console:

let betterNow = [1,2000,3000,4]
//ascending
betterNow.sort((a,b) => a-b)
console.log(betterNow)
//descending
betterNow.sort((a,b) => b-a)
console.log(betterNow)

results in:
image