SOURCE

function move({x=0,y=0}={}){
  console.log([x,y]);
  return [x,y];
}
// move({x:3,y:8});  //3,8
// move({x:3}) //3,0
// move({})  //0,0
// move();
// [1, undefined, 3].map((x = 'yes') =>console.log(x) );
function test1(){
  return [1,2,3]
}
function test2(){
  return{
    x:11,
    y:22
  }
}
let [x,y,z]=test1()
// console.log([x,y,z]) //1,2,3
let {x:a,y:b}=test2()
// console.log(a,b)  //11,22

var map = new Map();
map.set('first', 'hello');
map.set('second', 'world');

for (let [key, value] of map) {
  console.log(key + " is " + value);
}
let xx="hello"
let yy='hello is b';
console.log(xx.startsWith('hello'));
console.log(xx.indexOf('is'))
console.log(yy.endsWith('b'))
console.log(yy.includes('is'))
//Object是浅拷贝,如果元对象的属性值是一个对象,那目标对象拷贝得到的是这个对象的引用
var arr1={a:{b:2}}
var arr2=Object.assign({},arr1)
arr2.a.b=3
console.log(arr1.a.b,arr2.a.b)
//Object.keys(),Object.values(),Object.entries()
let {keys,values,entries}=Object;
let obj={a:1,b:2,c:3}
for(let [key,value] of entries(obj)){
	console.log([key,value])
}

//Set  类似于数组,但是成员的值都是唯一的,没有重复的值
//可用于去除数组的重复成员
[...new Set(array)]
const s=new Set();
[1,1,2,3,3,4,5,5,6].forEach(x=>s.add(x))
for(let i of s){
	console.log(i)
}

const s2=new Set([1,22,22,4,54,54,3])
console.log([...s2])








console 命令行工具 X clear

                    
>
console