1.

Discuss the arrow function.

Answer»

In ES6, arrow functions are introduced. The shorthand syntax for writing ES6 functions is arrow functions. The arrow function's DEFINITION consists of parameters, followed by an arrow (=>), and the function's body.

The 'fat arrow' function is another NAME for the Arrow function. We won't be able to employ them as constructors.

 CONST function_name = (arg_1, arg_2, arg_3, ...) => { //body of the function }

Few things to note:

  • It reduces the size of the code.
  • For a single-line function, the return statement is optional.
  • Bind the context lexically.
  • For a single-line statement, functional braces are not required.
  • Doesn’t WORK with new


Discussion

No Comment Found