From 053d3b76feb94d8c2ec620f1d58bf12e3e36a391 Mon Sep 17 00:00:00 2001 From: qianguyihao Date: Sat, 6 Jun 2020 18:31:03 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E9=80=BB=E8=BE=91=E8=BF=90=E7=AE=97?= =?UTF-8?q?=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 04-JavaScript基础/05-基本数据类型:Null 和 Undefined.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/04-JavaScript基础/05-基本数据类型:Null 和 Undefined.md b/04-JavaScript基础/05-基本数据类型:Null 和 Undefined.md index 1db42c0..3de9cb5 100644 --- a/04-JavaScript基础/05-基本数据类型:Null 和 Undefined.md +++ b/04-JavaScript基础/05-基本数据类型:Null 和 Undefined.md @@ -3,14 +3,14 @@ ## Null:空对象 -null 专门用来定义一个**空对象**(例如:`var a = null`)。。 +null 专门用来定义一个**空对象**(例如:`let a = null`)。 如果你想定义一个变量用来保存引用类型,但是还没想好放什么内容,这个时候,可以在初始化时将其设置为 null。 比如: ```js -var myObj = null; +let myObj = null; cosole.log(typeof myObj); // 打印结果:object ``` @@ -51,7 +51,7 @@ console.log(a); // 打印结果:Uncaught ReferenceError: a is not defined 如果一个函数没有返回值,那么,这个函数的返回值就是 undefined。 -或者,也可以这样理解:在定义一个函数时,如果没有 return 语句,那么,其实就是 `return undefined`。 +或者,也可以这样理解:在定义一个函数时,如果末尾没有 return 语句,那么,其实就是 `return undefined`。 举例: