小编Dou*_*ord的帖子

JavaScript函数中的默认参数值

可能重复:
如何为javascript函数创建参数的默认值

在PHP中:

function func($a = 10, $b = 20){
  // if func() is called with no arguments $a will be 10 and $ b  will be 20
}
Run Code Online (Sandbox Code Playgroud)

你怎么能用JavaScript做到这一点?

如果我尝试在函数参数中赋值,则会出错

缺少)正式参数后

javascript arguments function

222
推荐指数
4
解决办法
21万
查看次数

标签 统计

arguments ×1

function ×1

javascript ×1