Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[js] 第224天 请解释下NaN表示什么呢?typeof NaN结果是什么? #1567

Open
haizhilin2013 opened this issue Nov 25, 2019 · 7 comments
Labels
js JavaScript

Comments

@haizhilin2013
Copy link
Collaborator

第224天 请解释下NaN表示什么呢?typeof NaN结果是什么?

我也要出题

@haizhilin2013 haizhilin2013 added the js JavaScript label Nov 25, 2019
@NicholasBaiYa
Copy link

NaN : not a number.

@zeroone001
Copy link

typeof NaN === 'number'

@Jack-rainbow
Copy link

NaN:: not number, ecma中规定了 NaN 是Number类型。
typeof NaN === ‘number’

@Cleam
Copy link

Cleam commented Nov 29, 2019

点击查看MDN对NaN的解释说明

判断一个值是否是NaN

等号运算符(== 和 ===) 不能被用来判断一个值是否是 NaN。必须使用 Number.isNaN() 或 isNaN() 函数。在执行自比较之中:NaN,也只有NaN,比较之中不等于它自己。

NaN === NaN;        // false
Number.NaN === NaN; // false
isNaN(NaN);         // true
isNaN(Number.NaN);  // true

function valueIsNaN(v) { return v !== v; }
valueIsNaN(1);          // false
valueIsNaN(NaN);        // true
valueIsNaN(Number.NaN); // true

@d4c-27
Copy link

d4c-27 commented Apr 10, 2022

非数字 number

@mohaixiao
Copy link

NaN是“Not-A-Number” (非数值) 的缩写,用于表示本来要返回数值的操作失败了。是一个number类型。typeof NaN结果是‘number’

@xiaoqiangz
Copy link

不是一个数字,非Number。
'number'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
js JavaScript
Projects
None yet
Development

No branches or pull requests

8 participants