Which is the correct arrow function to add two numbers?

23. Which is the correct arrow function to add two numbers?

  1. add = (a,b) => a+b;
  2. add = (a,b) => return a+b;
  3. add = (a,b) => { return a+b;}
  4. Both A. and B.
  5. Both A. and C.

Answer: E) Both A. and C.

Explanation:

In ES6 – Below given both are the arrow functions to add two numbers:

add = (a,b) => a+b;
add = (a,b) => { return a+b;}

Comments and Discussions!









Copyright © 2023 www.includehelp.com. All rights reserved.