fn Function Declaration

Variables

Names bound to values. Prefer const, use let when you must reassign, avoid var.

Declaring

const name = "Ada";   // cannot be reassigned
let count = 0;        // can be reassigned
count = count + 1;

Scope

let and const are block-scoped — they exist only inside the { } where they are declared.

{
  const secret = 42;
}
// console.log(secret) -> ReferenceError