JavaScriptJavaScript · Lesson 03

Operators & Comparison

Arithmetic, == vs ===, logical operators and truthiness.

Video tutorialTrack course · freeCodeCamp
Speed
Next lesson
Watch 00:00 · 1 checkpoints Watch on YouTube More on this topic
Transcript & captions
6/6

Always use === and !== . The loose == converts types before comparing, which produces surprises like '5' == 5 being true.

Falsy values: false, 0, -0, '' , null, undefined, NaN. Everything else is truthy.

Try it yourself

Knowledge check

0/1 answered

Which operator only falls back for null/undefined?