This is interesting, I run the tests using Node (v14.17.6), in "theory" it should give you similar results to Chrome as they both use V8 as the engine, but it's clearly different
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.
Or use +
But thanks for pointing it out, I've updated the article adding the test results using the unary operator and
parseFloat
with the unary operator is still 5/6 times slower than
Number
Interesting - I tested on Firefox and using the unary
+
was almost twice as fast asNumber
- jsbench.me/v2kurpao3r/1The same bench on Chrome showed the two methods almost exactly the same speed - sometimes one would be faster than the other, sometimes not
This is interesting, I run the tests using Node (v14.17.6), in "theory" it should give you similar results to Chrome as they both use V8 as the engine, but it's clearly different