7 Major JavaScript Concepts Explained Simply

The purpose of lingo is to encapsulate a particular idea into a nice and compact word. However, meaning is lost if you don’t understand what the word means.

In the dev world, more advanced topics are often out of reach and often times discouraging for new developers. In part, it’s because it feels like they’re reading a foreign novel. The letters and words might look familiar, but none of it makes sense.

And it’s hard to make sense of everything, especially if you have to keep stopping every second word to figure out what the sentence is trying to tell you.

For this piece, I’ve decided to compile the top 7 concepts that I often find myself translating for new developers. I hope you find them useful in your quest to become a better developer.

1. immutability, mutation, mutable

Weak immutability is when the shape of your data doesn’t change. Strong immutability is when nothing about the object changes.

So if you have an object that goes into a function, it comes out of it in the exact same form. For weak immutability, the data attached to it can change, but the number of keys, names and order do not.

For example, this is a mutation:

function changeMe(someObject){ 
   someObject.age = 3; 
   return someObject; 
}

let exampleOne = {"cat": "Tibbers" };
console.log(changeMe(exampleOne));

The function changes the shape of the object, meaning that it is mutable.

For a more in-depth discussion on the topic, here’s something that can help you (in addition to a few other bonus techniques).

2. declarative

It doesn’t matter what order you do something in, the underlying rules ensure that you get the same and correct result every time.

For example, this mathematical equation follows a declarative methodology.

(2 x 5) + 8 - 3 = 15

So if you move the order around, you’re still going to get the same result.

- 3 + (2 x 5) + 8 = 15
8 - 3 + (2 x 5) = 15

In JavaScript programming, a declarative pattern is where the order of functions doesn’t matter to the construction of the final outcome. You can call them in any order. The sequence doesn’t matter.

3. recursion

When the function continues to call itself until a particular condition is fulfilled.

No. It’s not a for loop. It might sound like it, but it’s not.