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

第二十一题:var x, y = 1; x + y = ? #21

Open
Ray-56 opened this issue Sep 5, 2019 · 2 comments
Open

第二十一题:var x, y = 1; x + y = ? #21

Ray-56 opened this issue Sep 5, 2019 · 2 comments
Labels
JavaScript 解释型编程语言

Comments

@Ray-56
Copy link
Owner

Ray-56 commented Sep 5, 2019

var x, y = 1; x + y = ?

@Ray-56 Ray-56 added the JavaScript 解释型编程语言 label Sep 5, 2019
@MMmaXingXing
Copy link

答案 NAN

var x = undifind;
var y = 1;
undifind + y = NAN

@lamelamb
Copy link

js 中变量定义后没有赋值,默认是undefined ,而 数字 + undefined ,也就是数值型 和其他类型数据运算(非字符串型),会把非数值型数据转换成数值型,所以undefined 被转成 NaN ,NaN 和任何数值运算还是NaN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JavaScript 解释型编程语言
Projects
None yet
Development

No branches or pull requests

3 participants