Home »
MCQs »
ReactJS MCQs
Consider the below function – which is the correct syntax of arrow function?
22. Consider the below function – which is the correct syntax of arrow function?
Msg = function() {
return "Good Morning";
}
- Msg = () => {return "Good Morning";}
- Msg = () => "Good Morning";
- Both A. and B.
- None of the above
Answer: C) Both A. and B.
Explanation:
In ES6 – Below given both of the syntaxes are correct of arow function:
Msg = () => {
return "Good Morning";
}
Msg = () => "Good Morning";