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.
Loading...
Related Quiz
- Which HTTP status code represents a successful GET request?
- In Internet Explorer, instead of addEventListener, the _________ method is used to attach event listeners.
- The _______ method returns a Promise that resolves or rejects as soon as one of the promises in an iterable resolves or rejects, with the value or reason from that promise.
- What is the result of the comparison operator === if the operands are of different types?
- Which of the following is NOT a state of a Promise?