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