DEV Community

Cover image for The most important concepts you must know in JavaScript(JS)
davdev14
davdev14

Posted on

The most important concepts you must know in JavaScript(JS)

Why I wrote this article?

I realized that many of these free JavaScript courses out there be it on YouTube or other platforms don’t go through these very important concepts, many young developers take JavaScript courses from YouTube and build two or three simple projects and think they know 50% or even more on JavaScript which is most at times a complete illusion when compared to what can be done with JavaScript and how good software engineers code in JavaScript. As a young developer, you are not expected to know much about any programming language or even master it, NO!!! what you are expected to know are the main concepts in JavaScript that will enable you to write code that is clean, readable, efficient, reusable, robust, self-explanatory, and secure. In the next paragraphs, we will talk about all these main concepts all JS developers must know.

What exactly is JavaScript?

Before even knowing what you must know as a JS developer you have to know what exactly is JS.

So, As defined by freecodecamp.orgJavaScript is a dynamic programming language that's used for web development, in web applications, for game development, and lots more. It allows you to implement dynamic features on web pages that cannot be done with only HTML and CSS.” I will add more to this and say, JavaScript is a high-level programming language widely used for web development that enables developers to add interactivity and dynamic behavior to websites. It runs on the client side, executing within the user's web browser, and can manipulate web page content, respond to user actions, and communicate with servers. JavaScript supports object-oriented and event-driven programming, allowing for the creation and manipulation of objects and the execution of specific code in response to user events. With its ability to interact with the Document Object Model (DOM), JavaScript can dynamically modify the structure, styling, and content of web pages. It also supports asynchronous programming, facilitating tasks like making HTTP requests without blocking other code execution. JavaScript's cross-platform compatibility makes it versatile for creating web applications that work on different devices, while it is expanding ecosystem extends its usage to server-side, desktop, and mobile app development.

There are 5 main concepts in JavaScript that are there most crucial to know and understand when studying JavaScript. Take note that these concepts are NOT ALL that JavaScript is about but these are the main concepts that someone must know after learning JavaScript, these concepts can also be seen in other programming languages like PHP which makes it easy to learn PHP after getting these concepts right in JS. The concepts are as follows;

Data structures manipulation

Here I am talking about how to manipulate Arrays and Objects in JavaScript. A good JS developer is someone who knows how to manipulate Arrays using array methods like Array.push, Array. map, Array.slice, Array.find, etc… you should know how to do stuff like changing the position of an element in an Array using Array.slice or filtering an Array using Array.filter, you should go through MDN web docs and go through all the methods that can be used to manipulate Arrays. You should also be able to navigate into complex objects.

username

Pure functions and immutability

Here by pure functions, we mean your functions should not use variables that are not inside the function definition each time you want to use a variable that is outside your function you should recreate that variable inside the function using the spread operator. this will make debugging functions easier, prevent side effects and make unit testing more trustworthy.

Functional programming

Functional programming is one of the programming paradigms that emphasize creating pure functions and immutable data structures. In functional programming, programs are written using sequences of functions that take in data and send out data. This approach allows us to write programs that are, modular, easy to understand, debug and refactor.

Object oriented programming(OOP)

OOP is another programming paradigm that organizes code into objects which are instances of classes. classes are what define the characteristics(properties) and behavior(methods) of objects, In OOP we use classes to group functions(methods) that do similar things, these methods allow us to change the behavior of our properties or attributes. For example, you have a class User

that returns an object which is an instance of the class user and that object contains attributes like username, email, and password an example of a method here can be a method(function) that is defined inside the class to let's say change the user’s username with this method the user will be able to change his/her username. Note that, object-oriented programming can be used alongside functional programming, that is what you will see in most cases. classes and object-oriented programming is a feature common to many programming languages like PHP, Java, and C++, so knowing it will make it easier to transfer from one language to another

Async/Await

Basically, you should the able to do asynchronous operations. Async operations are those tasks that will run on their own side without stopping the flow of execution of the program. when we talk of Async/Await we usually refer to operations like making HTTP requests, reading to and writing from a database, or any other time-consuming operations, this is to allow the program to keep running while the HTTP request for example is being treated.

Inheritance and Polymorphism

Inheritance is simply the ability of an object or a class to inherit properties and methods from another object or class and polymorphism is the ability to modify the behavior of a function in an object or a class that is, you can have an instance of a class which of course is an object and in that object, there is a function that does something, you can change what that function does and this is what polymorphism is basically all about. These concepts are directly linked to OOP.

Var, Let, and Const

Another thing you should know is the difference between var, let, and const. I will give you a little sneak peek of when you should use var, let, or const

use var when you want a variable to be accessible globally. these variables can be reassigned

use let when you know the variable will be reassigned. these variables can be reassigned

using const when you know the variable will not be reassigned or redeclare

Bonus:

Take note that, this is not all that JavaScript has to offer or all you should learn in JS, there are still concepts like; DOM manipulation and events listeners. I didn’t mention them because they change when you start using frameworks like; React, Vue, or Angular for building the UI of your apps. However it’s still very important to understand the DOM, how it is manipulated, and how to manipulate it as well as listening to events to perform an action.

Top comments (1)

Collapse
 
overskilled profile image
Ouatedem Yvan

Great article, i definitely learned a thing or two 👌