cm0002@lemmy.world to Programmer Humor@programming.dev · 5 days agoWhich of these javascript expressions is false?lemmy.mlimagemessage-square80fedilinkarrow-up1505arrow-down111cross-posted to: [email protected]
arrow-up1494arrow-down1imageWhich of these javascript expressions is false?lemmy.mlcm0002@lemmy.world to Programmer Humor@programming.dev · 5 days agomessage-square80fedilinkcross-posted to: [email protected]
minus-squarejaark@infosec.publinkfedilinkEnglisharrow-up5arrow-down1·edit-25 days agoI don’t think my sanity can take all of these explanations. Though I just spotted one that’s worse than null being an object … typeof NaN "number" I mean, come on… it’s even in the fucking name! Edit - fixed capitalisation in ‘NaN’
minus-squarezarkanian@sh.itjust.workslinkfedilinkarrow-up5·5 days agoDouglas Crockford has a whole chapter of these in his latest book. There’s also this classic video.
minus-squareNat (she/they)@lemmy.blahaj.zonelinkfedilinkarrow-up4·5 days agoNumber = IEEE-754 double precision float, which includes NaN, so it makes sense
I don’t think my sanity can take all of these explanations.
Though I just spotted one that’s worse than null being an object …
typeof NaN "number"
I mean, come on… it’s even in the fucking name!
Edit - fixed capitalisation in ‘NaN’
Douglas Crockford has a whole chapter of these in his latest book. There’s also this classic video.
Number = IEEE-754 double precision float, which includes NaN, so it makes sense