arrow function arguments code example
Example 1: arrow function rec
(param1, param2, …, paramN) => { statements }
(param1, param2, …, paramN) => expression
// equivalent to: => { return expression; }
// Parentheses are optional when there's only one parameter name:
(singleParam) => { statements }
singleParam => { statements }
// The parameter list for a function with no parameters should be written with a pair of parentheses.
() => { statements }
Example 2: Arrow Functions
// The usual way of writing function
const magic = function() {
return new Date();
};
// Arrow function syntax is used to rewrite the function
const magic = () => {
return new Date();
};
//or
const magic = () => new Date();
Example 3: javascript arrow function
let errow = () => {
//the code you want to return;
};
Or
let errow = ('paramiter') => {
//the code you want to return
}