Skip to content

Properties of JS

Course: Javascript 101 - chapter 3

Every language comes with it’s unique set of features.

Javascript has the following -

JavaScript is an interpreted language, meaning it’s executed line-by-line at runtime by the JavaScript engine in the browser or server environment, rather than being compiled into machine code beforehand.

**Upsides - **

  1. There is one less step to do before running your code **Downsides - **

  2. Performance Overhead:

  3. More prone to runtime errors

Variables in JavaScript are not bound to a specific data type. Types are determined at runtime and can change as the program executes

#include <iostream>
int main() {
int a = 1;
a = "hello";
a = true;
}
var a = 1;
a = "harkirat";
a = true;
console.log(a)

JavaScript executes code in a single-threaded environment, meaning it processes one task at a time. We will dive deeper into this next week.

JavaScript automatically manages memory allocation and deallocation through garbage collection, which helps prevent memory leaks by automatically reclaiming memory used by objects no longer in use.

Is JS a good language?

Yes and no. It is beginner friendly, but has a lot of performance overhead. Bun is trying to solve for a lot of this, but there’s a long way to go before JS can compete with languages like C++/Rust