- Data Types:
undefined
, null
, boolean
, number
, string
, object
, symbol
, bigint
- Variables & Scope:
var
, let
, const
, block scope, global scope
- Operators: arithmetic operators, comparison operators, logical operators, bitwise operators
- Control Flow:
if/else
, switch
, for/while
loops, break/continue
- Functions: function declarations, function expressions, arrow functions (brief mention, detailed in ES6+)
- Type Coercion: implicit vs. explicit conversion
- Equality:
==
vs. ===
- Strict Mode:
"use strict"
- meaning and effects
- Closure
- this
Variable Declarations
let a = 10; // Block-scoped variable
const PI = 3.14; // Constant (cannot be reassigned)
var b = 20; // Function-scoped variable (not recommended)
Data Types
let num = 10; // Number
let str = "Hello"; // String
let flag = true; // Boolean
let arr = [1, 2, 3]; // Array (object)
let obj = { name: "JS" }; // Object
let undef; // Undefined
let empty = null; // Null
Type Checking
console.log(typeof 42); // "number"
console.log(typeof "Hi"); // "string"
console.log(typeof null); // "object" (JavaScript bug!)
console.log(typeof undefined); // "undefined"
Operators
Arithmetic Operators
let a = 5, b = 2;
console.log(a + b); // 7
console.log(a - b); // 3
console.log(a * b); // 10
console.log(a / b); // 2.5
console.log(a % b); // 1
console.log(a ** b); // 25 (Exponentiation)
Comparison Operators