JavaScript Arrow Functions


Wed Jun 17 2020 07:32:06 GMT+0000 (UTC)

Saved by @Dante Frank #javascript

const playThe = (funky) => {
  return funky + " music";

const playThe = funky => {
  return funky + " music";

const playThe = funky => funky + " music";

// You can call all of these functions like: `playThe('blues')`

These are just a shorter way to write a function. They do have some special rules however, and understanding the rules imposed by arrow functions will help you understand callbacks. We're going to ignore the this binding rules for these functions for now. If there is only one argument, the parenthesis () can be omitted if arrow functions are one line, the brackets {} can be omitted. When omitting the brackets, the arrow function returns the evaluated expression without requiring the return keyword.