Learn

Functions

# Arrow Functions

Arrow functions offer several benefits over traditional function expressions. They provide a more compact syntax with less code, making your codebase more readable and maintainable.

### Syntax

The syntax for an arrow function looks like this:

The arrow (`=>`

) separates the function parameters from the function body, which is enclosed in curly braces (`{}`

). If the function has only one parameter, you can omit the parentheses around the parameter list. If the function has no parameters, you must include empty parentheses.

### Examples

Here are a few examples to illustrate the usage of arrow functions:

## Instructions

**1.**

Change the `sum`

function into an arrow function.

**2.**

Call and log the new `sum`

function with two arguments of your choice.

Sign up to start coding

Already have an account?

Sign In