--- title: 'null' slug: Web/JavaScript/Reference/Global_Objects/null translation_of: Web/JavaScript/Reference/Global_Objects/null ---
مقدار null نمایان گر مقداری هست که به صورت دستی (عمدی) می توانیم به یک متغییر نسبت دهیم،null یکی از {{Glossary("Primitive", "نوع های اولیه")}}. جاوا اسکریپت می باشد.
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"
typeof null // object (bug in ECMAScript, should be null) typeof undefined // undefined null === undefined // false null == undefined // true
مشخصات | وضعیت | توضیحات |
---|---|---|
{{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}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |