Tip: You can re-write midpoint as const midpoint = arr.length >> 1
midpoint
const midpoint = arr.length >> 1
While that might be faster, I think the original might be clearer.
I would agree. Software is written for humans, not computers. Although, interesting, this seems like a premature optimization.
Actually this way you avoid using Math.floor and it's not so bad. Its just a build-in operator
Math.floor
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.
Tip: You can re-write
midpoint
asconst midpoint = arr.length >> 1
While that might be faster, I think the original might be clearer.
I would agree. Software is written for humans, not computers. Although, interesting, this seems like a premature optimization.
Actually this way you avoid using
Math.floor
and it's not so bad. Its just a build-in operator