#i use tag -> tumblr screams that this html is unsupported
Explore tagged Tumblr posts
not-toivo · 1 year ago
Text
so, this:
Tumblr media
parseInt works with strings (which i knew), and if its argument isn't one, it gets converted into a string (which i haven't thought about, but which is completely logical). what i didn't know is that there are upper and lower limits at which JS switches from stringifying numbers into series of digits to displaying them using scientific notation:
Tumblr media
the limits are 1e+21 and 1e-6, btw. also, yes, you can call methods directly on numeric literals. no, you can't do that on integers without either putting them in parentheses first or typing 2 dots instead of 1, because JS interprets a single dot as part of the number and not the property accessor, which is a completely sane behaviour.
Tumblr media
lovely.
1 note · View note