Skip to content
Learn Netverks

Lesson

Step 8/36 22% through track

operators-comparisons

Operators and comparisons

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 Operators and comparisons—the ideas, syntax, and habits you need before moving on in JavaScript.

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

You will apply Operators and comparisons 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 Operators and comparisons in your own words.

Arithmetic (+ - * / %), logical (&& || !), and comparison operators drive control flow.

Truthy and falsy

Falsy: false, 0, '', null, undefined, NaN. Everything else is truthy—including '0' and [].

Nullish coalescing

?? returns right side only when left is null or undefined—unlike || which treats 0 as missing.

Important interview questions and answers

  1. Q: || vs ??
    A: || treats 0 and '' as falsy; ?? only null/undefined.
  2. Q: Short-circuit &&?
    A: Stops evaluating when left is falsy—used for guards.

Self-check

  1. Name four falsy values.
  2. When is ?? better than ||?

Pitfall: == coerces types—prefer ===.

Interview prep

=== vs ==?

Strict equality avoids type coercion surprises.

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