Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

difference between undefined and null?

null is a special object because typeof null returns 'object'. 
On the other hand,
undefined means that the variable has not been declared,
or has not been given a value.
Comment

difference between undefined and null javascript

undefined: It means a variable declared, but no value has been assigned a value.

//example: 
var demo;
alert(demo); //shows undefined
alert(typeof demo); //shows undefined

null: Whereas, null in JavaScript is an assignment value. 
You can assign it to a variable.

//Example: 
var demo = null;
alert(demo); //shows null
alert(typeof demo); //shows object
Comment

what is the difference between null and undefined

Undefined  used for unintentionally missing values.

Null       used for intentionally missing values. 
Comment

difference between undefined and null

null == undefined
Comment

PREVIOUS NEXT
Code Example
Javascript :: indexof method 
Javascript :: Uncaught SyntaxError: Cannot use import statement outside a module 
Javascript :: delete element of array javascript 
Javascript :: accessing objects inside array 
Javascript :: get index vanilla js 
Javascript :: disabling ctrl + s using javascript 
Javascript :: MaterialStateProperty width 
Javascript :: js loop 
Javascript :: Find duplicate or repeat elements in js array 
Javascript :: js copy values from one array to another node new 
Javascript :: moment to date object 
Javascript :: select the first elemnt have class in jquery 
Javascript :: array index javascript show only first 2 elements 
Javascript :: node isfile or isdirectory 
Javascript :: check if an array contains a number in javascript 
Javascript :: hello world react 
Javascript :: leaflet tile service 
Javascript :: js convert array to object 
Javascript :: javascript optional add object key 
Javascript :: express js hello world example 
Javascript :: javascript array flatten 
Javascript :: render twice react 
Javascript :: firebase messaging import script 
Javascript :: updatable time js 
Javascript :: jquery post with promises 
Javascript :: react js bootstrap select option required 
Javascript :: apollo clear cache for query 
Javascript :: how to get data form 
Javascript :: tab key event in angular 
Javascript :: react hook form reset only one field 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =