Plenty of π
Module 2: Variables, Data Types, Type Casting, and Comments
Primitive Data Types

Primitive data types are the most basic data types in JavaScript. They are immutable (their values cannot be changed directly; operations on them create new values).

  1. String: Represents textual data. Enclosed in single quotes ('...'), double quotes ("..."), or backticks (`...` - template literals).

    let greeting = "Hello";
    let name = 'Alice';
    let message = `Welcome, ${name}!`; // Template literal with interpolation
    
  2. Number: Represents both integer and floating-point numbers. JavaScript has only one number type.

    let integerNum = 100;
    let floatNum = 3.14;
    let scientificNum = 2.5e6; // 2.5 * 10^6
    

    Special numeric values: Infinity, -Infinity, NaN (Not a Number).

  3. BigInt: Represents integers of arbitrary length. Created by appending n to the end of an integer literal or by calling BigInt().

    let largeNumber = 123456789012345678901234567890n;
    let anotherBigInt = BigInt("98765432109876543210");
    
  4. Boolean: Represents a logical entity and can have two values: true or false.

    let isActive = true;
    let isLoggedIn = false;
    
  5. undefined: A variable that has been declared but not yet assigned a value has the value undefined.

    let myVar;
    console.log(myVar); // Output: undefined
    
  6. null: Represents the intentional absence of any object value. It is an assignment value, meaning it can be assigned to a variable as a representation of no value.

    let emptyValue = null;
    
  7. Symbol (ES6+): A unique and immutable primitive value that may be used as the key of an Object property. Less common in everyday beginner scripting.