1//If body has single statement
2let myFunction = (arg1, arg2, ...argN) => expression
3
4//for multiple statement
5let myFunction = (arg1, arg2, ...argN) => {
6 statement(s)
7}
8//example
9let hello = (arg1,arg2) => "Hello " + arg1 + " Welcome To "+ arg2;
10console.log(hello("User","Grepper"))
11//Start checking js code on chrome inspect option
1const plantNeedsWater = day => day === 'Wednesday' ? true : false;
2
3//If only 1 Parameter no () needed
4//Single line return is implicit
5//Single line no {} needed
1([a, b] = [10, 20]) => a + b; // result is 30
2({ a, b } = { a: 10, b: 20 }) => a + b; // result is 30
3
1let oddNumbers = numbers.filter(number => number % 2);Code language: JavaScript (javascript)