https://discordapp.com/channels/392832386079129630/704005036732055723/706130765007683596
so, we have normal functions:
//regular function
function aNameForFunction(aparametertogive) {
// run some code here.
};
// arrow functions (also known as fat arrow syntax)
const aNameForFunction = (parameter, moreparameter, ...) => {
// run some code.
};
Now... there are a few things we can do with arrow functions that are really powerful. If we have only 1 parameter, we don't need parentheses, like this:
const aFunction = aparameter => {
// run some code.
}
And finally, we have another thing we can do... if we only have 1 liners.. we can ignore the brackets too!
const aFunction = aparameter => console.log('This is a one liner implicit returned console log!');
// a more powerful example:
const anArray = [1, 2, 3, 4, 5];
const aGoodFunction = anArray => anArray.forEach(itemInTheArray => console.log(itemInTheArray));