Null in JavaScript: Primitive or Object? 🤔🔎

preview_player
Показать описание
Null in JavaScript: Primitive or Object? 🤔🔎

#JavaScript #WebDev #Programming #Coding #LearnToCode
Рекомендации по теме
Комментарии
Автор

One of the key reasons it has not been fixed is because fixing it now would surely break a lot of existing programs. So it is better for everyone to let it that way.

HaroldWilliamsYou
Автор

Undefined isn't nothingness it's undefined. When something is undefined that means that something is there it is just impossible to know what that is. Whereas null is a nothing value. (I think that a null value can't be freed where an undefined one can be. Though I am not sure about that)

skeleton_craftGaming
Автор

A language created in 10 days! Wow learned something new today.

albismogaming
Автор

Makes perfect sense. I don't know which is worse, 10 days of implementation or nearly 30 years of ignoring a bug. Go JS!

gabor_kov
Автор

In js is all are object, like let a = 5, but we can write like this let a = new Number(2) and this give you and object later they convert thisn in number , so that why we can use methods over it, but js don't recommend to use new keyword on this primitive data type and null is some kind of value which means nothing not 0 beacuse 0 is value, you will get null when you will not get the value from somewhere rather than undefined

Vickycooldu
Автор

Once IE 6 said, null is null and is not an object. IE 6 lied to me 😢

eduardoromao
Автор

ChatGpt gave me this

When JavaScript was first created in 1995, values were represented using a type tag. These type tags were stored in bits. The type tag for objects was 0. The special value null was represented internally as the NULL pointer, which was also 0. So when checking the type, null had the same tag as objects — and thus typeof null returned "object".

elson_correia
Автор

Actually I think null as an object make sense, undefined is used in cases where object is not defined ie. you should raise error in a function when received variable is undefined. But another situation is you want a object that have similar properties to 0 in integer format, which (1) gives false in conditional statements, (2) used as a default value when intializer is not defined for the variable with a particular type of the object.

lowzhao
Автор

Not much of a fan of this course. Its more of a quick crash course than a full JS course. The title is also quite misleading because theres no way possible you get "professional" knowledge after finishing it. The way she explains some important topics also doesnt help. If you want to start from zero look somewhere else

thegoldenwithatie
Автор

I think this makes me love Javascript. I like the jokes😂

MarcosLima-cscd
Автор

Открываем спецификацию.. и понимаем, что она бред несет

dmitrykulakov
Автор

Blows my mind how a language this badly designed is supported by every browser

lwlw
Автор

null does NOT represent nothingness. `null` represents the absence of a defined property. Like when you try to access `person.address` for a homeless person.
`undefined` describes a value that is not even defined, like In contrast to which I'd expect to be defined; even if it is null.
The bad part is that you can assign `undefined` to a defined property, that `property in object` and `object[property] !== undefined` are not consistent

thomasersosi
Автор

still perpetutating the myth how javascript was mad drinkinking coffee and few days rofl... :DDDD

Microphunktv-jbkj
Автор

If you are new to programming, start something useful than ducktaped "programming language" called js. 😅

WeAreByteableGames
Автор

I have been coding in JS for quite some time now, and null vs undefined is just dumb. They do exactly the same, throw exceptions and represent missing.

miguelcalles
Автор

AI replace teacher teacher confusing brain monkey

lachidong
join shbcf.ru