JavaScript - The Basics

Web Development Overview

Web development involves writing a lot of HTML, CSS and JS code.

Historically (and even today to some extent), browsers could only understand HTML, CSS and JS.

Any website that you see is a bunch of HTML, CSS and JS files along with some assets (images, videos etc).

Js basics.webp

<aside> Important Facts:


Properties of JavaScript

Every language comes with its unique set of features. JavaScript has the following:

1. Interpreted Language

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.

Screenshot_2024-08-04_at_6.04.48_PM.webp

2. Dynamically Typed

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

// C++ Code (won't compile)
#include <iostream>

int main() {
    int a = 1;
    a = "hello";  // Error
    a = true;     // Error
}
// JS Code (will compile)
var a = 1;
a = "harkirat";
a = true;

console.log(a)