English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
JavaScript Global Properties/Function
null valuerepresenting the intentional absence of any object value.
It is JavaScript'sOne of the primitive types.
The null value is not an identifier for a global object property, such as undefined. Instead, null represents a lack of identification, indicating that the variable does not point to any object.
null
var str; if (str == null) { // str is null } // str is not null }Test and see‹/›
The values of null and undefined are equal, but the types are different.
When checking null or undefined, please note the difference between equals (==) and identity (===) operators, as the former performs type coercion.
typeof null // "object" (due to legacy reasons, it is not "null") typeof undefined // "undefined" null == undefined// true null === undefined // falseTest and see‹/›
All browsers fully support null values:
Value | |||||
null | Yes | Yes | Yes | Yes | Yes |
JavaScript Version: | ECMAScript 1 |
---|
If the given string does not contain [aeiou] letters, the getVowels() function will return 0:
function getVowels(str) { var x = str.match(/[aeiou]/gi); if (x === null) { return 0; } return x.length; }Test and see‹/›