1.

How to unset a JavaScript variable?

Answer»

Generally, in JavaScript we create functions USING the function KEYWORD:

var points = [98, 45, 78, 65, 99]; var DEMO = points.map(function(val) {   return val + val; })

Using the Fat arrow function REDUCES line of code and even avoids you to write the keyword “function” again and again.

The syntax of fat arrow function includes =>, wherein it shows fat arrow:

ARG => exp

For multiple arguments:

(arg1 [, arg2]) => exp

Let’s see what you need to do with fat arrow function while implementing the code snippet we saw above: 

var points = [98, 45, 78, 65, 99]; var demo = points.map((val) => val+val);


Discussion

No Comment Found