Home »
MCQs »
ReactJS MCQs
Which is the correct arrow function to add two numbers?
23. Which is the correct arrow function to add two numbers?
- add = (a,b) => a+b;
- add = (a,b) => return a+b;
- add = (a,b) => { return a+b;}
- Both A. and B.
- 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;}