In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you what the meaning of null in javascript, I believe that most people do not know much, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Null is one of the basic data types of javascript. Null is used to indicate that the value of the variable is empty. We can clear the object by setting the value to null, with syntax such as "var person = null;".
This article operating environment: windows7 system, javascript1.8.5 version, DELL G3 computer
Null is one of the basic data types of javascript, and null is used to indicate that the value of the variable is empty.
We can clear the object by setting the value to null:
Such as
Var person = null; / / value is null, but the type is still an object
JavaScript data type
Value type (basic type):
String (String), number (Number), Boolean (Boolean), empty (Null), undefined (Undefined), Symbol.
Reference data type:
Object (Object), array (Array), function (Function).
Note: Symbol is a new primitive data type introduced by ES6 that represents a unique value.
Undefined and null
The value of type Undefined has only one undefined, which is used to indicate that a variable does not exist or that no value is assigned to it, as well as that the property of the object does not exist. Null is used to indicate that the value of the variable is empty. The difference between Undefined and null is subtle. In general, undefined means that no value is set for the variable or the property does not exist, while null means that the variable has a value, only that its value is null.
But many times undefined and null themselves want to wait without an exact comparison, that is, null==undefined will return true. If you want to make a precise distinction between null and undefined, you should consider using the exact equals (=)
/ declare variables x, yvar x, y = null;// to determine whether the value of x is empty if (x = undefined) {alert ('default value after variable declaration is undefined');} if (x = null) {alert (' default value after variable declaration is null');} / / determine whether x (its value is undefined) is equal to y (its value is null) if (x = y) {alert ("x (undefined) = y (null)") } / / Test a non-existent attribute if (String.xyz = undefined) {alert ("non-existent attribute value defaults to undefined");} above is all the content of the article "what does null in javascript mean?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.