NaN is a number type, so is it a numeric value inside js and how to express it?

what is the similar expression for NaN in JS?

typeof NaN = "number", NaN is a number type, so is it a 64 floating point number in js like any other number?

feels that NaN is similar to 0

for the numerical type ~ ~ num, it will be converted to a 32-bit integer, and if the original value is also an integer not greater than 2 * 31, it will be the same

    let num = 0;
    ~num; // -1
    ~~num; // 0
    ~~num === num; // true
    //  NaN
    ~NaN; // -1
    ~~NaN; // 0
    ~~NaN === num

so NaN is a special 0, or 0 has two states?

May.27,2021

I think. Don't think too much, it's just a coincidence.

~ is a bit-by-bit inversion, and of course it is itself to take the reverse twice.

bitwise inversion is played like this:

clipboard.png

ECMAScript 1st Edition (ECMA-262)

~.

clipboard.png

ToInt32():

clipboard.png

ToInt32NaN(Infinity)0

:
clipboard.png


https://www.zhihu.com/questio.
" so NaN has a total of (2 ^ 52-1) * 2 (multiplied by 2 because it is positive or negative)

Menu