مقدار null نمایان گر مقداری هست که به صورت دستی (عمدی) می توانیم به یک متغییر نسبت دهیم،null یکی از نوع های اولیه. جاوا اسکریپت می باشد.
شیوه ی نوشتن
null
توضیح
null باید به صورت حروف کوچک نوشته شود،null اقلب برای مشخص کردن مکان object به کار برده می شود و به هیچ object وابسته نمی باشد
زمانی که می خواهید مقدار null یا undefined را بررسی کنید به تفاوت مابین عملگر های بررسی (==) و (===) اگاه باشید.
// 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"
تفاوت بین null و undefined
typeof null // object (bug in ECMAScript, should be null)
typeof undefined // undefined
null === undefined // false
null == undefined // true
مشخصات
مشخصات | وضعیت | توضیحات |
---|---|---|
ECMAScript 1st Edition (ECMA-262) | Standard | Initial definition. |
ECMAScript 5.1 (ECMA-262) The definition of 'null value' in that specification. |
Standard | |
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'null value' in that specification. |
Standard | |
ECMAScript Latest Draft (ECMA-262) The definition of 'null value' in that specification. |
Draft |
سازگاری مرورگرها
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |