single line function javascript code example
Example 1: javascript oneline function
const sum = (x, y) => x + y;
Example 2: arrow function rec
(param1, param2, …, paramN) => { statements }
(param1, param2, …, paramN) => expression
(singleParam) => { statements }
singleParam => { statements }
() => { statements }
Example 3: javascript 1 line if
(lemons) ? alert("please give me a lemonade") : alert("then give me a beer");
Example 4: concise body arrow functions javascript
const plantNeedsWater = day => day === 'Wednesday' ? true : false;