Hasty Briefsbeta

Bilingual

What Is JavaScript Made Of? — overreacted

13 hours ago
  • JavaScript values are abstract 'things' (e.g., numbers, strings, objects), while statements like 'if' are not values.
  • Primitive values (numbers, strings) are immutable and cannot be created or changed; each instance of the same primitive is identical.
  • Variables act as 'wires' pointing to values; 'let' allows reassignment, 'const' forbids it, and 'var' has confusing scoping.
  • Objects are values with properties (wires to other values); each object literal creates a unique new value (unlike primitives).
  • Arrays are objects with numeric properties, and prototypes determine property lookup behavior for missing properties.
  • Functions are special values representing code; parameters pass data, while 'this' depends on how a function is called.
  • Arrow functions lack their own 'this', closures keep outer variables alive, and recursion requires careful termination to avoid stack overflow.