JavaScript null vs. undefined

preview_player
Показать описание
What is the difference between null and undefined. In JavaScript these are actually two different things.

Рекомендации по теме
Комментарии
Автор

thank you steve so much, i have a question for example if i'm trying to console log a variable called name and i haven't declared this variable, why i'm getting undefined and not null ? i mean since this variable name doesn't exist at all why we get undefined instead of null since null is the absence of value an clearly this variable doesn't exist should it make sense to get null

eh-lodo
Автор

What do you mean by global object sir?

romeojoseph
Автор

If its null then its intentional and if its undefined then something when wrong

rayleighslivers
Автор

so whats the point though...i haven't found any videos that give a good reason as to why you would need to purposefully set a value to nothing

superreverbfreak