📜  js 函数 arg 默认值 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:18.882000             🧑  作者: Mango

代码示例1
function multiply(a, b = 1) {
  return a * b;
}

console.log(multiply(5, 2));
// expected output: 10

console.log(multiply(5));
// expected output: 5