/**
I think that you might be looking for
the js "arrow function"; I hope that
this example below helps ;)
**/
// usual function
function fartOne(){
console.log('Pooofff... pof.. ppf.. poof.. p');
}
// arrow function to do the same
const fartTwo = () => console.log('Baaaf... paf.. poof.. poffie.. plop');
// call the functions to test 'em out..
fartOne();
fartTwo();
// You can use => to define arrow functions.
const getSum = (a, b) => {
return a + b
}
getSum(1, 2) // 3
"""=> meaning in javascript"""
// Traditional Function
// Create their own scope inside the function
function (a){
return a + 100;
}
// Arrow Function
// Do NOT create their own scope
// (Each step along the way is a valid "arrow function")
// 1. Remove the word "function" and place arrow between the argument and opening body bracket
(a) => {
return a + 100;