What is the difference between null and undefined in JavaScript?

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

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

30条回答
  •  我在风中等你
    2020-11-21 23:46

    null: absence of value for a variable; undefined: absence of variable itself;

    ..where variable is a symbolic name associated with a value.

    JS could be kind enough to implicitly init newly declared variables with null, but it does not.

提交回复
热议问题