Answers for "js default args"

0

js default args

function multiply(a, b = 1) {
  return a * b;
}

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

console.log(multiply(5));
// expected output: 5
Posted by: Guest on December-16-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language