this can be an alternative one line solution. here
I don't get it. I tried with:
const arr = [100, 22, 22, 44, 44, 44,44];
It doesn't seem to work.
sorry, i forgot to mention. You need to write the sort function explicitly. Otherwise sorts as a string and 4 > 1 :)
arr.sort((a, b) => a - b)
Clever.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
this can be an alternative one line solution.
here
I don't get it.
I tried with:
It doesn't seem to work.
sorry, i forgot to mention.
You need to write the sort function explicitly. Otherwise sorts as a string and 4 > 1 :)
Clever.