~(function () {}).toString();
is absolutely valid JavaScript syntax and I saw that it returns -1
.
I know that ~
is not operator. For instance ~5
=~0101
which means 1010
in base 2 and 10
in decimal.
console.log(~(function () {}).toString());
But what is the explanation in this situation ?
Maybe ~NaN
returns -1
.