What is the difference between these two JavaScript data types?

Hello,

The Introduction to JavaScript course (DataTypes) expresses that the following two data types have different uses, would you be able to tell me what each of them are used for and, if possible, provide an example.

undefined & null

With kindest regards,

Richard.

they say a picture is worth a thousand words, so here we go:

1 Like

Thank you @stetim94. That does make a lot of sense:

non-zero value means a value that is not zero (possibly negative);

0 means nothing;

null means something may be placed there but isn’t there yet; and

undefined means nothing may be placed there.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.