OsrsNeedsF2P@lemmy.ml to Programmer Humor@programming.dev · 8 months agoparseInt(5)lemmy.mlimagemessage-square58fedilinkarrow-up1471arrow-down16
arrow-up1465arrow-down1imageparseInt(5)lemmy.mlOsrsNeedsF2P@lemmy.ml to Programmer Humor@programming.dev · 8 months agomessage-square58fedilink
minus-squaredanda@lemmy.ziplinkfedilinkarrow-up93·8 months agoIt’s because parseInt is expecting a string, so the decimal gets converted to a string, and 0.0000005.toString() returns 5e-7.
minus-squareSpaceNoodle@lemmy.worldlinkfedilinkarrow-up17·edit-28 months agoWhat if I pass in a Stewart Copeland?
minus-squareKindaABigDyl@programming.devlinkfedilinkarrow-up40arrow-down1·8 months agoCommon Dynamic Typing L
minus-squareAnotherPenguin@programming.devlinkfedilinkEnglisharrow-up4·8 months agoMore like javascript L, even python would throw a TypeError for this example.
It’s because parseInt is expecting a string, so the decimal gets converted to a string, and
0.0000005.toString()returns5e-7.deleted by creator
What if I pass in a Stewart Copeland?
or a Honda civic
deleted by creator
Common Dynamic Typing L
More like javascript L, even python would throw a TypeError for this example.