博客
关于我
解构赋值
阅读量:328 次
发布时间:2019-03-04

本文共 392 字,大约阅读时间需要 1 分钟。

let [a,b]=[1,2];let [foo,[[bar],baz]]=[1,[[2],3]];let [ , , the] = ["foo","bar","baz"];// the = "baz"let [head, ...tail] = [1,2,3,4];// head 1// tail [2,3,4]// 结构赋值允许默认值let [foo=true]=[];

for of便利Map

var map = new Map();
map.set("a", "name");
for (let [key, value] of map) { // 遍历键值对}

输入模块的指定方法

const {     SourceMapConsumer,     SourceNode } = require(source-map);

转载地址:http://yvsh.baihongyu.com/

你可能感兴趣的文章