Sign in

Hi✋ I'm Divine🙂 A Frontend Developer excited about sharing helpful coding tips😊💻
Photo by Dragos Gontariu on Unsplash.

I remember the first time I came across the term closure. It was on an Instagram post listing out some important JavaScript topics.

After seeing this post, I tried to find a simple tutorial on closures. I went through so many examples, but I still wasn’t getting a grasp on it. Most of the tutorials I came across online never gave real examples that could be easily implemented. This made it very difficult for me to know how and where to use closures.

At some point, I thought of just forgetting the topic and advancing to other JavaScript topics. …

Froot Loops
Photo by Kai Wenzel on Unsplash.

Sometimes there are certain tasks we would want to run continuously in our program. Instead of rewriting the code each time for the same task, we could easily use loops in JavaScript to repeatedly run these tasks.

What Looping Means

A loop is a programming feature that iterates a set of tasks or directives as long as a particular condition is met.

Loops check a condition. If the condition is met (i.e. if it returns true), a set of code will run. The condition is checked again, and if it still returns true, the set of code is run again. This cycle continues…

A laptop with codes written in it
Photo by Oskar Yildiz on Unsplash

Writing good code is simple as it is tricky. The rules below may seem like the most common or logical thing to do, but when you look around the web or go through other developer's codes, you will realize that the “common or logical thing to do” is not very common in most codes.

Understanding and adhering to the rules below will make you a more effective developer and will allow other developers to build upon your work more effortlessly.

1. Reduce Activities in a Loop

Loops are often used in JavaScript to perform repeated tasks based on a condition without re-writing the task each time.

Divine Favour

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store