From 218934fa2ed1c702a6d3923d2aa2cc6b43c48684 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:43:23 -0500 Subject: initial commit --- .../reference/global_objects/null/index.html | 124 +++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 files/zh-tw/web/javascript/reference/global_objects/null/index.html (limited to 'files/zh-tw/web/javascript/reference/global_objects/null') diff --git a/files/zh-tw/web/javascript/reference/global_objects/null/index.html b/files/zh-tw/web/javascript/reference/global_objects/null/index.html new file mode 100644 index 0000000000..0af88facab --- /dev/null +++ b/files/zh-tw/web/javascript/reference/global_objects/null/index.html @@ -0,0 +1,124 @@ +--- +title: 'null' +slug: Web/JavaScript/Reference/Global_Objects/null +translation_of: Web/JavaScript/Reference/Global_Objects/null +--- +
{{jsSidebar("Objects")}}
+ +

The value null represents the intentional absence of any object value. It is one of JavaScript's {{Glossary("Primitive", "primitive values")}}.

+ +

語法

+ +
null 
+ +

描述

+ +

The value null is written with a literal, null (it's not an identifer for a property of the global object like {{jsxref("Global_Objects/undefined","undefined")}} can be). In APIs, null is often retrieved in place where an object can be expected but no object is relevant. When checking for null or undefined beware of the differences between equality (==) and identity (===) operators (type-conversion is performed with the former).

+ +
// foo does not exist. It is not defined and has never been initialized:
+> foo
+"ReferenceError: foo is not defined"
+
+// foo is known to exist now but it has no type or value:
+> var foo = null; foo
+"null"
+
+ +

Difference between null and undefined

+ +
typeof null        // object (bug in ECMAScript, should be null)
+typeof undefined   // undefined
+null === undefined // false
+null  == undefined // true
+
+ +

規範

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('ES1')}}{{Spec2('ES1')}}Initial definition.
{{SpecName('ES5.1', '#sec-4.3.11', 'null value')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-null-value', 'null value')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-null-value', 'null value')}}{{Spec2('ESDraft')}} 
+ +

瀏覽器相容性

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +

參見

+ + -- cgit v1.2.3-54-g00ecf