Exploring JavaScript Fundamentals!
Tags: programming, javascript, fundamentals
Published: 2023-08-08 12:25:07

### What is JavaScript?

JavaScript is a versatile and widely-used programming language primarily used for building interactive and dynamic features on websites and web applications.

Now let’s dive deeper into some intriguing concepts:

### High Abstraction

So here the question comes what is abstraction? An abstraction is a way of hiding the implementation details and showing only the functionality to the users.

In the context of programming, abstraction allows developers to work on complex systems or concepts without needing to understand all the underlying complexities

So that means JavaScript is hiding more technical complexities and inner workings from the developers.

When we work with JavaScript, we’re interacting with a high-level language that shields us from the low-level details of memory management, hardware interactions and other technical aspects. This abstraction simplifies the development process, making it more accessible and efficient to create interactive and dynamic web applications.

### Garbage Collected

In JavaScript, we don’t need to worry about garbage cleanup. An algorithm inside JavaScript takes care of garbage collection and cleaning.

So, when you’re done using something in JavaScript, like an old toy you don’t play with anymore, you can just forget about it. The garbage collector will swing by when you’re not looking and scoop up all those forgotten things, freeing up space for new things you want to use.

### JIT compiled

JavaScript is not purely interpreted language; rather, modern JavaScript is Just in Time compiled. It’s a process that dynamically translates the human-readable code into machine-executable code at run time, significantly enhancing its performance and execution speed.

In contrast, an interpreted language like Python or Ruby directly executes the source code line by line without an intermediate compilation step. This can lead to comparatively slower execution speeds since the code is translated on-the-fly during runtime.

On the other hand, a compiled language, such as C++ or Java, first translates the entire source code into machine code before execution. This often results in faster performance compared to interpreted languages as the compilation step optimizes the target platform’s code before execution.

### Multi-paradigm

First, what is a paradigm? Well, the paradigm is a mindset of code structure that will determine your coding style.

In programming, going multi-paradigm means something cool -it’s about mixing and matching different programming styles within one programming language. Each style or paradigm brings its own set of tools and techniques to the table. When you blend these paradigms, you get a coding toolbox that’s more diverse and versatile, kind of like having a bunch of superpowers.

In JavaScript, there are:

1. Procedural Programming(step-by-step instructions)

2. Object Oriented Programming or (OOP)

3. Functional Programming(FP)

So, when you go multi-paradigm with JavaScript, you’re not stuck with just one way to code — you get to pick what works best for each situation.

### Prototyped-based

In JavaScript, nearly everything is treated like an object, except for the primitive data types.

Now, a “prototype” is like a blueprint or a template that an object can inherit properties and methods from. It’s like a handy guide that helps objects know what they can do and how they should behave. So, instead of creating every object from scratch, JavaScript lets you create one object with all the cool stuff, and then other objects can borrow those cool traits.

Let’s say you have a “Car” object with all the details about speed, colour, and even how to start the engine. You can then make new car objects that inherit all these details, and you can even add or change stuff if you want — it’s like making customized versions of the original.

So, when JavaScript is prototyped-based, it’s all about this dynamic link between objects.

### Functions are the first-class citizen

This means you can treat functions like VIPs in the world of programming. They are so flexible that you can toss them around wherever you like. It’s like having these versatile tools that you can use however you want.

For example, You can treat functions as available. You can pass a function as a parameter of a function. You can return a function from inside of another function. This feature gives a lot of flexibility while using functions

### Dynamically Typed

This means you don’t have to play the “label game” when you create a variable in JavaScript. You know how, in some languages, you have to put a tag on your variable saying it’s a number, a text, or something else? Well, in JavaScript, you’re free from that hassle.

When you declare a variable, you don’t need to say, “Hey, this is going to be a number!” or “Hold on, this will be a string!” No tags, no declarations — you can just dive right in.

### Single-Threaded

Single-threaded means the execution of instructions happens in a single sequence. It’s like having a single-lane road where cars follow each other in a straight line, without any branching or parallel paths.

So, when your code runs single-threaded, it’s like taking one step at a time — no jumping ahead or going in different directions. It’s like reading a story from the beginning to the end, not skipping chapters.