函数参数的扩展
参数的默认值
// ES6之前,方法不能为参数直接指定默认值,只能通过参数判定的方式,为参数设置默认值。 function testFunc(x, y) { y = y || 'ES6'; console.log(x, y); } testFunc('Welcome to'); // Welcome to ES6 testFunc('Welcome to', 'China'); // Welcome to China testFunc('Welcome to', ''); // Welcome to ES6