Arrow functions

/** * Arrow function básica */ const helloWorld1 = function () { return 'Hello World'; }; const helloWorld2 = () => { return 'Hello World'; }; const helloWorld3 = () => 'Hello World'; console.log(helloWorld1()); console.log(helloWorld2()); console.log(helloWorld3()); const soma = (a, b) => a + b; console.log(soma(4, 6)); const valor = (a) => a; console.log(valor(4)); /** * Hoisting com funções literais e arrow function */ console.log(somaLiteralFunction(4, 2)); function somaLiteralFunction(a, b) { return a + b; } // console.log(somaArrowFunction(4, 2)); const somaArrowFunction = (a, b) => a + b; console.log(somaArrowFunction(4, 2));