Can someone explain to me why my filtered array is not sorting with the sort method?
It is sorted!! >=) Just not how you think… the sort method accepts an optional ‘compare’ function. If no compare function is passed in… the numbers are converted to string values, and then sorted by Unicode value.
“I can only upload one image so… I’m going to try to send 3 replies to answer this completely”
1 Like
So, in order to get them to sort by Ascending Numerical value… which is what I assume u want… we have to specify how they are to sort the values.
1 Like
You might not be able to absorb everything in this MDN page, but it’s worth a few minute read
1 Like
thank you @mechanicDev ! makes sense
1 Like