OsrsNeedsF2P@lemmy.ml to Programmer Humor@programming.dev · 5 months agoparseInt(5)lemmy.mlimagemessage-square62linkfedilinkarrow-up1505arrow-down16
arrow-up1499arrow-down1imageparseInt(5)lemmy.mlOsrsNeedsF2P@lemmy.ml to Programmer Humor@programming.dev · 5 months agomessage-square62linkfedilink
minus-squaredanda@lemmy.ziplinkfedilinkarrow-up102·5 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-up43arrow-down1·5 months agoCommon Dynamic Typing L
minus-squareAnotherPenguin@programming.devlinkfedilinkEnglisharrow-up5·5 months agoMore like javascript L, even python would throw a TypeError for this example.
minus-squareSpaceNoodle@lemmy.worldlinkfedilinkarrow-up18·edit-25 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