What is the difference between undefined and null | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What is the difference between undefined and null

undefined vs null

22nd Jun 2017, 11:13 AM
Da' BO$
Da' BO$ - avatar
2 Answers
+ 7
undefined: a variable has been declared but hasn't been assigned a value. var lol; null: an assignment value for a variable as a representation of no value. var lmao=null; null == undefined // true null === undefined //false In this case, they have the same value but different type.
22nd Jun 2017, 11:51 AM
Berli 🇮🇩
Berli 🇮🇩 - avatar
+ 1
tnx Gabby
22nd Jun 2017, 12:16 PM
Da' BO$
Da' BO$ - avatar