Arrow Functions

Published Jun 4, 2021Updated May 15, 2024
Contribute to Docs

Arrow function expressions are alternatives to traditional functions that were first introduced in ES6. Aside from a relatively concise syntax, arrow functions have a few semantic differences along with some limitations.


const functionA = (parameter1, parameter2, ..., parameterN) => {
  // Function body here

The syntax for an arrow function expression does not require the function keyword and uses a fat arrow (=>) to separate the parameter(s) from the body.

Arrow functions can be defined with zero or more parameters, on one or more lines. In most cases, parentheses (()) are not required to be around the parameter list if there is one parameter. They are required in the following cases:

  • There is more than one parameter.
  • There are no parameters.
  • The single parameter is a destructured object.
  • There are default or rest parameters involved.

Arrow functions with a single expression have no curly brackets ({ }) and can use the concise function body to return the result of the expression without the return keyword. For multiple expressions, parentheses can be alternatively wrapped around the arrow function body to implicitly return the result.


Arrow functions are limited and can’t be used in all situations:

  • They do not have their own bindings to this or super, and should not be used as methods.
  • They cannot be used as constructors.
  • They cannot use yield, within its body.
  • They cannot use the special arguments keyword.


The following example showcases how arrow functions are defined and applied:

const printHello = () => {
const checkWeight = (weight) => {
console.log(`Baggage weight: ${weight} kilograms.`);

This produces the following output:

Baggage weight: 25 kilograms.

Codebyte Example

The following example features an arrow function defined with two arguments on a single line:

Visit us
Hide code
Hide output
Hide output

All contributors

Looking to contribute?

Learn JavaScript on Codecademy