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";
}
  1. Msg = () => {return "Good Morning";}
  2. Msg = () => "Good Morning";
  3. Both A. and B.
  4. 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";

Comments and Discussions!









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