Converting a traditional function method to an arrow function method

Jesus Nieves
Jan 27, 2022

--

We are going to do it in three simple steps that we can apply in all our functions.

Let’s take as a starting point the following function that returns a greeting to our dear user;

Let’s start breaking down the function;

First step

We change the word function to const.

Second step

We add the equals sign = between the function name and the argument.

Third and last step

Now we add the mighty arrow, we do this between the argument and the opening bracket.

Done, we have converted our old traditional function into an arrow function.

If you want to know everything about arrow functions, take a look at this article.

Thanks for going through this quick guide.

--

--

Jesus Nieves

✖Member of the @xteam, 👊🏽Software Engineer at @riotgames 👨🏽‍🏫Mentor at @FrontEndCafe 📢Speaker at @fundacionjaa ✍🏼Writer at @medium