InterviewSolution
Saved Bookmarks
| 1. |
Why should arrow functions not be used in ES6? |
|
Answer» One of the most popular features of ES6 is the "arrow functions" (also KNOWN as "FAT arrow functions"). Arrow functions are a NEW way to write CONCISE functions. Arrow functions offer a compact alternative to TRADITIONAL function expressions, but they have limitations and cannot be used in every case. The following is an ES5 function: function timesTwo(params) { return params * 2 }timesTwo(5); // 10The same function can also be expressed as an arrow function in ES6 as follows: var timesTwo = params => params * 2timesTwo(5); // 10Differences & Limitations:
|
|