Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
inaba46256yYes, you make sure your numbers are numbers when you need to do number stuff with them. parseInt or parseFloat it. If you need to string stuff with them make sure they're strings.
Just like in all other languages -
inaba46256y@rabbi using typescript would still mean you would have to parse your strings to numbers. It does not help in that regard
-
rabbi16186y@inaba Yes, but it will throw an error if you try '1' + 3 instead of just silently deciding that it should be 13.
-
inaba46256y@rabbi Yet that would still require him to, and I quote, "parsing every value". It's like suggesting jquery to sum two numbers.
Is there actually a proper way to do Math in Javascript, without parsing every value to avoid something like
"1" + 3 = 13 ?
rant
trying to learn
proper math
start to hate dynamic var types
wtf is going on with that language
javascript
advice needed