Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Operators & Expressions | JavaScript Course lesson | BraveProgrammer
  1. Courses
  2. /
  3. JavaScript Course

Lesson 4 of 55

·javascript

Operators & Expressions

9 mins

Course progress7%

What you'll learn

Keep these ideas in mind as you work through the lesson.

3 points
  • Prefer `===`/`!==` over `==`/`!=` to avoid unwanted coercion.
  • `?.` (optional chaining) prevents runtime errors when accessing deep properties.
  • `??` is useful for default values when the real value can be `0` or `''`.

Arithmetic, comparison, logical, bitwise, assignment, and ternary operators.

OperatorExampleMeaning
+ - * / %5 * 2arithmetic
=== !==a === bstrict equality
&& ||a && blogical AND / OR
?:cond ? a : bternary (inline if)
??a ?? bnullish coalescing
?.obj?.propoptional chaining

Example: Nullish coalescing vs logical OR

let foo = 0;
console.log(foo || 42);   // 42 (because 0 is falsy)
console.log(foo ?? 42); // 0  (nullish coalescing only for null/undefined)
Make it stickPractice what you've learned1 quiz · 7 practical tests · Optional activities from JavaScript CourseBrowse activities
Previous lessonData Types & Type‑CoercionContinue to lesson 5Control Flow – if / switch / loopsBack to JavaScript Course curriculum