Day #4 Pro Tip #Javascript

Undefined is not null , Happy Realization….

Manjula Dube
Geekabyte
1 min readMar 26, 2018

--

Happy Realization :)

JavaScript uses both undefined and not null, but they are used in different context.Null is default value for objects, while undefined is for variables and properties. For an object to be null, it must be defined, otherwise it will be undefined. The below code depicts this case.

The below code throws throws an error, myObject must be defined first before check for null

The below code returns false

Thanks for reading

Stay tuned for more updates !!!

--

--

Manjula Dube
Geekabyte

Senior Developer, Javascript Lover, Frontend Technology, Passion is to learn and share.