es6 - 剩余参数
剩余参数就是解决arguments的问题
剩余参数是由三个点...和一个紧跟着的剧名参数指定...keys的组成(打印keys是一个数组)
eg:
let book = {
title:“es6教程”,
author:"学学",
year:2020
}
function pink(obj,...keys){
let result = Object.create(null);
for(let i = 0;i<keys.length;i++){
result[key[i]] = obj[keys[i]];
}
return result;
}
let bookDate = pick(book,'year','author');