Can default parameters be expressions or function calls?

  • No, only primitive values are allowed
  • Yes, any valid expression or function call is allowed
  • Only function calls are allowed
  • Only arrow function expressions are allowed
Yes, default parameters in ES6 can be expressions or function calls. This enables dynamic default values based on the evaluation of expressions or the result of function calls. It provides flexibility and allows for more sophisticated default values in function parameters.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *