What are arrow functions 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
function (a){
return a + 100;
}
(a) => {
return a + 100;
}
(a) => a + 100;
a => a + 100;
Example 3: concise body arrow functions javascript
const plantNeedsWater = day => day === 'Wednesday' ? true : false;
Example 4: arrow function
Arrow Function is another way to write a function.
"classic method":
function x ()
{
console.log("X")
}
"arrow method":
var x= ()=>
{
console.log("X")
}
if we need to add paramiter is pritty simple:
var x = (PARAMS) =>
{
console.log(PARAMS)
}
Have a nice day
Example 5: arrow function
Killing deer, wounding cowboys, getting to the right place, moving up a line