function get(url,{body='',headers={}}){}
get('http://www.baidu.com',{});//正常
get('http://www.baidu.com');//报错
const mySort = (...numbers) => numbers.sort();//rest 参数
[1,2,3].concat(['a','b','c']);//[1, 2, 3, "a", "b", "c"]
console.log(mySort.name);//返回函数名
console.log((()=>{}).name);//返回空白
var obj = {
*m(){
yield 'hello world';//Generator 函数
}
}
let foo = 'bar';
let baz = {foo};
console.log(baz);
var o={
hi(n){
console.log('Hi,',n);
}
};
func f1(){};
func f2(){};
module.exports={f1,f2};
var target = {a:1};
var source = {b:2};
var newObj = Object.assign(target,source);
const clone = source=>return Object.assign({},source);
const merge = (target,...sources)=>Object.assign(target,...sources);
ECMAScript 6 —— 知识点(七) 函数和对象
猜你喜欢
转载自blog.csdn.net/wuxinwudai/article/details/80829008
今日推荐
周排行