cm0002@lemmy.world to Programmer Humor@programming.dev · 16 days agoWhich of these javascript expressions is false?lemmy.mlimagemessage-square83linkfedilinkarrow-up1513arrow-down111cross-posted to: programmerhumor@lemmy.ml
arrow-up1502arrow-down1imageWhich of these javascript expressions is false?lemmy.mlcm0002@lemmy.world to Programmer Humor@programming.dev · 16 days agomessage-square83linkfedilinkcross-posted to: programmerhumor@lemmy.ml
minus-squaresmlckz@programming.devlinkfedilinkarrow-up2·edit-23 days agoAnother way to check whether a number is NaN: const isNaN = res !== res; As NaN is the only value out there that is not equal to itself. See my other comment on this post for more: https://programming.dev/comment/17221245 This comparison should work in every programming language out there that implements/respects/uses IEEE 754 floating point numbers.
Another way to check whether a number is
NaN
:As
NaN
is the only value out there that is not equal to itself. See my other comment on this post for more: https://programming.dev/comment/17221245This comparison should work in every programming language out there that implements/respects/uses IEEE 754 floating point numbers.