English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
null valueindicating the intentional absence of any object value.
It is JavaScript'sOne of the primitive types.
The null value is not an identifier of a global object property, such as undefined. On the contrary, null indicates the absence of an identifier, indicating that the variable does not point to any object.
null
var str; if (str == null) { // str is null } else { // str is not null }테스트를 보세요‹/›
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, because the former performs type conversion.
typeof null // "object" (due to legacy reasons, it is not "null") typeof undefined // "undefined" null == undefined// true null === undefined // false테스트를 보세요‹/›
모든 브라우저는 null 값을 완벽히 지원합니다:
값 | |||||
null | 네 | 네 | 네 | 네 | 네 |
JavaScript 버전: | ECMAScript 1 |
---|
주어진 문자열이 [aeiou] 문자를 포함하지 않으면 getVowels() 함수는 0을 반환합니다:
function getVowels(str) { var x = str.match(/[aeiou]/gi); if (x === null) { return 0; } return x.length; }테스트를 보세요‹/›