DEV Community

Cover image for JavaScript - All You Need to Know about JS
Riyad Hossain
Riyad Hossain

Posted on • Updated on

JavaScript - All You Need to Know about JS

There are some core concepts in JavaScript (also known as JS) which is very essential to learn. In this blog, I tried to give a short yet to-the-point demonstration of those crucial concepts of JS. Surely, after you learnt those topics, JavaScript will become less weird to you. So, without any further ado! Let’s get started.

High Abstraction
In programming, high abstraction means comparatively complex parts are hidden and simplifier parts are viewed. The syntax of high-abstraction languages is easy compared to low-level languages like C, and Java which makes it easier for programmers to work with a high-abstraction language like JavaScript, Python, Go and so on.

Garbage Collector
Unlike low-level languages like C, we don’t need to maintain memory manually in JavaScript. Rather, JavaScript uses automatic memory management which is called Garbage Collection. Using the Mark-and-Sweep algorithm, the JavaScript engine automatically collects the unused memory allocations and then removes them.

JIT Compiled
With the help of JIT (just in time) compilation, the program is compiled during the execution time into native code to improve performance. Modern browsers support JIT compilation to compile JavaScript code which makes the execution time faster.

Multi-paradigm
A multi-paradigm language allows programmers to design a program in multiple approaches. JavaScript supports Object-oriented Programming, procedural Programming, Functional Programming and so on.

Prototyped-based
Obviously, JavaScript is a prototyped-based language, meaning the properties and methods of an object can be shared throughout generalized objects that can be cloned and extended. In simple words, you can clone an object’s properties and methods and also can add additional properties and methods to that newly cloned object.

Dynamically Typed
Simply, in JavaScript type of a variable is checked in the run time. For that, we don’t even need to specify the data type of a variable. Moreover, it’s called loosely typed language because data types also can be changed automatically in the execution time which is called type coercion. However, TypeScript, a superset of JavaScript, is a statically typed language.

Single-Threaded
JS has one call stack and one memory heap which means there is only one thread(process) for the instructions to be executed. Straightforwardly, only one statement is executed at a time in JavaScript.

Asynchronous
Although a single-threaded language, JavaScript behaves asynchronously with the help of the callback queue and event loop. The asynchronous statements are stored in the callback queue and get called by the event loop and after that get executed whenever the synchronous operations are executed.

Non-Blocking
Non-blocking refers to the notion of not blocking the execution for further operation. JavaScript doesn’t wait to complete the extended I/O operations and HTTPS requests. Instead of waiting, it stores the asynchronous statement in the callback queue and executes the rest of the synchronous operations. This non-blocking concept is also related to the asynchronous behaviour of JavaScript which we already discussed.

Functions are first-class citizens
Functions are called first-class citizens in JavaScript. Because, in JavaScript, functions can be declared as variables, can be passed as an argument in another function, and can be returned from a function. Also, functions can be set as a method of an object.

Note: In this blog, I just tried to give an overview on most crucial features and characteristic of JavaScript. Now it's your duty to learn more about these above mentioned topics.

Top comments (0)