From c1cc4c3f7ecacf9a66d939cb15665bc5c9812967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E7=A5=A5?= <1366971433@qq.com> Date: Mon, 16 Dec 2019 16:43:30 +0800 Subject: [PATCH] =?UTF-8?q?ES6=E5=9F=BA=E7=A1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notes/ES6_基础.md | 63 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 4 deletions(-) diff --git a/notes/ES6_基础.md b/notes/ES6_基础.md index f9e2860..fcb83e6 100644 --- a/notes/ES6_基础.md +++ b/notes/ES6_基础.md @@ -1,4 +1,59 @@ # ECMAScript 6 基础 + + ## 一、变量声明 @@ -1342,7 +1397,7 @@ console.log(example.multiply(1, 2)); - 以 `./` 为起始,表示从当前目录开始解析; - 以 `../` 为起始,表示从父级目录开始解析。 -### 12.3 导入导出重命名 +### 12.4 导入导出重命名 ES6 支持对导入导出的原始名称进行重命名: @@ -1361,7 +1416,7 @@ console.log(typeof add); // "undefined" console.log(sum(1, 2)); // 3 ``` -### 12.4 导入导出默认值 +### 12.5 导入导出默认值 ES6 支持使用 `default` 关键字来实现默认值导出,一个模块只能有一个导出默认值,它代表的就是整个模块,实现方式如下: @@ -1391,7 +1446,7 @@ import sum from "./example.js"; console.log(sum(1, 2)); // 3 ``` -### 12.5 导入再导出 +### 12.6 导入再导出 ES6 支持对导入的模块进行再导出: @@ -1404,7 +1459,7 @@ export { sum as add } from "./example.js"; export * from "./example.js"; ``` -### 12.6 无绑定导入 +### 12.7 无绑定导入 有些模块可以没有任何导出,例如只修改了全局作用域的对象,如下: