//ES6支持在定义函数的时候为其设置默认值: function foo(height = 50, color = 'red') { // ... console.log('height='+height+' color='+color); } foo() // height=50 color=red foo(10,'green')//height=10 color=green