Implicit return in arrow functions

If a JavaScript arrow function immediately returns a value, writing return is optional (if we also remove the curly brackets). The return is then implied, making it an “implicit return”.

// we could write the `return` explicitly
const getPumpedAbout = thing => {
  return `Pumped about ${thing}!`

// if we write it like this, the `return` is implied
const getPumpedAbout = thing => `Pumped about ${thing}!`

// there is no difference in how we would call these functions
getPumpedAbout('implicit returns') // ⇒ 'Pumped about implicit returns!'

There is more to learn

Get free previews of my upcoming course materials and other bonus content to help you work smarter. I share tips straight to your inbox once a week. You can read previous mails in the newsletter archive.

Cannot show form because cookie consent was not given.