My current hobby is writing cursed code and actually using it

Jun 6, 2023 3:31 AM

Believe it or not this averages out to be faster across browser(firefox/chrome/edge) than the recommended ways of rounding. Although, just use 0|num instead of a string. It's quite a big difference if you're writing real time applications such as games.

Until next time!

programming

confessions_from_a_programmer

cursed

development

software

js is weird because it has to be weird. don't let it get to ur head :)

2 years ago | Likes 1 Dislikes 0

It's truncating though, "2.7" will end up as "2" as well.

2 years ago | Likes 1 Dislikes 0

That's generally what flooring does ;) Should have probably said that instead of rounding

2 years ago | Likes 1 Dislikes 0