0Pricing
JavaScript Academy · Lesson

Primitives vs Objects & Core Types

Primitives vs objects; the seven primitives; quick typeof checks and common beginner pitfalls.

Intro

Goal: Tell primitives from objects and recognize all seven primitive types with quick checks.

  • Seven primitives
  • Objects vs wrappers
  • typeof tour
Primitives vs Objects & Core Types — illustration 1

Seven primitives: typeof tour

JavaScript has 7 primitives: number, bigint, string, boolean, null, undefined, symbol.

// Seven primitives and typeof
const n = 42;                 
// number
const bi = 42n;               
// bigint
const s = "hello";            
// string
const b = true;               
// boolean
const u = undefined;          
// undefined
const nl = null;              
// null (primitive)
const sy = Symbol("id");      
// symbol (unique each time)

console.log(typeof n, typeof bi, typeof s, typeof b);
console.log(typeof u, typeof nl, typeof sy);
// Note: typeof null is "object" (historical quirk)
Primitives vs Objects & Core Types — illustration 2

All lessons in this course

  1. Primitives vs Objects & Core Types
  2. typeof, Truthy/Falsy, and == vs ===
  3. Type Coercion: Safe Patterns to Avoid Surprises
← Back to JavaScript Academy