Using Arrow Functions

Published by mkjlong in

Create a function that returns the given argument, but by using an arrow function.

An arrow function is constructed like so:

arrowFunc=(/*parameters*/)=>//code here

Examples

arrowFunc(3) ➞ 3

arrowFunc("3") ➞ "3"

arrowFunc(true) ➞ true

Notes

Check the Resources tab for more information on arrow functions.

Watch a quick demo on how Edabit works.