What is the output of the following? “`js function foo(a, b = a * 2, c = a + b) { return [a, b, c]; } console.log(foo(3)); “`

JavaScript Medium
Select the correct answer: Single Choice

Key points

  • Default parameter values are evaluated at runtime
  • Default values can be expressions
  • Parameters without default values must be defined before those with default values

Ready to go further?