es6为参数提供了默认值

es6为参数提供了默认值,在定义函数的时候提供了初始值,以便参数没有传入的时候便可以使用。

function action(num = 600){
	console.log(num);
}
action(0)//0
action(100)//100
action()//600

猜你喜欢

转载自blog.csdn.net/qq_35209064/article/details/85680937