JavaScript fundamental you need to know
May 8, 2021
- Arrow function and multiple parameter
in javaScript ES6 released arrow function it is another structure of function
it is very simple to use in your code. if you want to pass one parameter then you don’t have to write first bracket. and if you are not using second bracket it will be return manually what do you want . in this example i will explain
const example = one => console.log(one);
if you are using second bracket you need to return it. for example
const example = num => {
return num * 2;};
if you want to pass more than one parameter in this case you have to write parameter with first bracket.
const example = ( num1, num2 ) => num1 + num2;