Write Cleaner JavaScript with These Style Tips

Ayla Yersel
Level Up Coding
Published in
3 min readJul 19, 2021

--

Photo by Cookie the Pom on Unsplash

You’ve done it, you magnificent bastard. You’ve taken the leap. Bitten that bullet. Taken the advice of nearly all tech Twitter.

You, you glorious creature, have started learning JavaScript.

Now it’s time to level up your code.

This article outlines three style tips to use to write cleaner, more concise JavaScript. Neater code is easier to read (and therefore debug). Taking the time to learn these tips will help save time later on.

Let’s get started.

1. Use arrow function expressions

If you’re reading this, odds are you’ve already encountered JavaScript functions. They look something like this:

function myFunction(parameter) {
statement;
}

Good news, friends: there’s a better (read : more concise) way to write a function.

Meet the arrow function expression.

Its name is a mouthful, but trust me, the arrow function expression is your friend…

--

--