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

undefined和null区别 #17

Open
Liqiuyue9597 opened this issue Aug 9, 2020 · 3 comments
Open

undefined和null区别 #17

Liqiuyue9597 opened this issue Aug 9, 2020 · 3 comments

Comments

@Liqiuyue9597
Copy link
Owner

No description provided.

@Liqiuyue9597
Copy link
Owner Author

null更像C++语言中的空指针,将变量赋值为null表示这是一个引用类型,只是暂时没有值。
undefined表示当前变量声明了但未赋值。

@ChinaWuhua
Copy link

个人理解:
null:已定义,但没有值
undefined:未定义

@liboliang01
Copy link

个人理解:
undefined:已声明还未赋值
null:值为空

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

No branches or pull requests

3 participants