DEV Community

yogesh2019
yogesh2019

Posted on

1

Difference bet null and undefined

Number 1

null is intentionally set and means nothing
undefined means that the boxes exist but not filled

Number 2

null has a type of object
undefined gives us a type of undefined

Number 3

console.log(isNaN(1+null)) gives false
console.log(isNaN(1+undefined)) gives true

Number 4

Any variable which is not initialized and a method which doesn't have any return type, By default it is assigned a type of "unassigned".

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →