-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
- let
- const
- 解构赋值
let { id, status, data: number } = jsonData;// 对象的解构
[a, b] = [b, a]; // 交换变量的值- 设置参数默认值,且可以通过参数默认值强制要求传参
function mandatory() {
throw new Error("Missing parameter");
}
function foo(mustBeProvided = mandatory()) {
return mustBeProvided;
}- 模版字符串两个反引号,
${}用来添加变量 - 使用扩展运算符
...拷贝数组。
const itemsCopy = [...items];
const nodes = Array.from(foo); //等同于👇
const nodes = Array.prototype.slice().call(foo);- 箭头函数(没有自己的
this和arguments - 模块化
import和export:
export default es6;
......
import {firstName, lastName, year} from './profile';- Class
- Promise
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels