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.

Data Types & Type‑Coercion | JavaScript Course lesson | BraveProgrammer
  1. Courses
  2. /
  3. JavaScript Course

Lesson 3 of 55

·javascript

Data Types & Type‑Coercion

10 mins

Course progress5%

What you'll learn

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

3 points
  • JavaScript is loosely typed – values are converted automatically in many operations.
  • `===` (strict equality) checks **type and value**, while `==` performs coercion.
  • `typeof null` is `"object"` – a historic bug; use strict checks when needed.

Primitive types:

  • Number – all numbers are floating point (NaN, Infinity).
  • String
  • Boolean
  • null – intentional absence of any value.
  • undefined – uninitialised.
  • Symbol – unique identifiers.
  • BigInt – arbitrarily large integers.

Objects, arrays and functions are reference types.


Example: Type coercion pitfalls

'5' + 3   // "53" (string concatenation)
'5' - 3   // 2   (numeric subtraction)
true + 1  // 2   (true → 1)
Make it stickPractice what you've learned1 quiz · 7 practical tests · Optional activities from JavaScript CourseBrowse activities
Previous lessonVariables – var, let & constContinue to lesson 4Operators & ExpressionsBack to JavaScript Course curriculum