OsrsNeedsF2P@lemmy.ml to Programmer Humor@programming.dev · 8 months agoparseInt(5)lemmy.mlimagemessage-square61linkfedilinkarrow-up1500arrow-down16
arrow-up1494arrow-down1imageparseInt(5)lemmy.mlOsrsNeedsF2P@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-up43arrow-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.Common Dynamic Typing L
More like javascript L, even python would throw a TypeError for this example.
deleted by creator