Which of the following is a correct syntax for an arrow function?

  • (param1, param2) => { return expression; }
  • function(param1, param2) { return expression; }
  • (param1, param2) { return expression; }
  • (param1, param2) -> { return expression; }
The correct syntax for an arrow function in JavaScript is '(param1, param2) => { return expression; }'. Arrow functions are known for their concise syntax, especially when there's a single expression to return. The '=>' syntax is used to define arrow functions.
Add your answer
Loading...

Leave a comment

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