arrow function callback code example
Example 1: Arrow Functions
const magic = function() {
return new Date();
};
const magic = () => {
return new Date();
};
const magic = () => new Date();
Example 2: arrow function javascript
const power = (base, exponent) => {
let result = 1;
for (let count = 0; count < exponent; count++) {
result *= base;
}
return result;
};
const square1 = (x) => { return x * x; };
const square2 = x => x * x;
const horn = () => {
console.log("Toot");
};
Example 3: concise body arrow functions javascript
const plantNeedsWater = day => day === 'Wednesday' ? true : false;