main.js
1
2
3
4
5
6
7
function multiply(a, b = 2) {
  console.log(a); // => 5
  console.log(b); // => 2
  return a * b;
}
console.log(multiply(5));            // => 10
console.log(multiply(5, undefined)); // => 10
Native Browser JavaScript