What is the difference between null and undefined in JavaScript?

前端 未结 30 3355
夕颜
夕颜 2020-11-21 23:06

I want to know what the difference is between null and undefined in JavaScript.

30条回答
  •  后悔当初
    2020-11-21 23:37

    I'll explain undefined, null and Uncaught ReferenceError:

    1 - Uncaught ReferenceError : variable has not been declared in your script, there is no reference to this varaible
    2 - undefined: Variable declared but does not initialised
    3 - null : Variable declared and is an empty value

提交回复
热议问题