OsrsNeedsF2P@lemmy.ml to Programmer Humor@programming.dev · 8 months agoparseInt(5)imagemessage-square61linkfedilinkarrow-up1506arrow-down16
arrow-up1500arrow-down1imageparseInt(5)OsrsNeedsF2P@lemmy.ml to Programmer Humor@programming.dev · 8 months agomessage-square61linkfedilink
minus-squaredanda@lemmy.ziplinkfedilinkarrow-up102·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-squareKindaABigDyl@programming.devlinkfedilinkarrow-up44arrow-down1·8 months agoCommon Dynamic Typing L
minus-squareAnotherPenguin@programming.devlinkfedilinkEnglisharrow-up5·8 months agoMore like javascript L, even python would throw a TypeError for this example.
minus-squareSpaceNoodle@lemmy.worldlinkfedilinkarrow-up18·edit-28 months agoWhat if I pass in a Stewart Copeland?
It’s because parseInt is expecting a string, so the decimal gets converted to a string, and
0.0000005.toString()returns5e-7.Common Dynamic Typing L
More like javascript L, even python would throw a TypeError for this example.
deleted by creator
What if I pass in a Stewart Copeland?
deleted by creator
or a Honda civic