Skip to content
Learn Netverks

Lesson

Step 7/36 19% through track

data-types-primitives

Primitives and typeof

Last reviewed May 28, 2026 Content v20260528
Track mode
client_javascript
Means
In-browser JS
Reading
~1 min
Level
beginner

This lesson

This lesson teaches Primitives and typeof—the ideas, syntax, and habits you need before moving on in JavaScript.

Without a solid grasp of Primitives and typeof, you will repeat mistakes in JavaScript exercises and on real pages or scripts.

You will apply Primitives and typeof in contexts like: Browsers, Node.js services, edge workers, and tooling ecosystems (bundlers, test runners).

Run JavaScript in the in-browser sandbox, use the terminal output panel, and verify with MCQs.

When the previous lesson's MCQs feel easy and you can explain Primitives and typeof in your own words.

Primitives: string, number, boolean, null, undefined, symbol, bigint. Objects (including arrays and functions) are reference types.

typeof quirks

typeof null === 'object' is a long-standing bug—check value === null explicitly.

Comparisons

Use === and !== (strict) instead of == which coerces types.

Important interview questions and answers

  1. Q: typeof null?
    A: Returns 'object'—use strict null checks.
  2. Q: Number pitfalls?
    A: IEEE floats—0.1 + 0.2 !== 0.3 exactly; use rounding or integers for money.

Self-check

  1. List five primitive types.
  2. Why prefer === over ==?

Tip: Use Number.isNaN(x) instead of x === NaN.

Interview prep

typeof null?

Returns 'object'—use explicit null checks.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs in your browser in a sandboxed frame. Backend runners appear when this track’s profile allows them.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • What would you log to verify this behavior?
  • What breaks if you run this before the DOM is ready?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump