undefined和null的区别 发表于 2020-05-13 null是有值,但值是空。undefined是值未定义。 typeof null === 'object', typeof undefined === 'undefined。 JSON.stringify会忽略undefined值,但会保留null值; 他们都是falsy ,不加!比较,永远是false (Boolean(undefined) ->// false, Boolean(null) ->// false);