Skip to content

undefined and NaN are not constants. They are global…

“undefined and NaN are not constants. They are global variables, and you can change their values. That should not be possible, and yet it is. Don’t do it.” quote by Douglas Crockford
Download Open image
““undefined and NaN are not constants. They are global variables, and you can change their values. That should not be possible, and yet it is. Don’t do it.””

Douglas Crockford

About This Quote

This interpretation was drafted with AI assistance. It is one reading of the quote, not the author's own explanation.

NaN and undefined are mutable global variables, contrary to expectations of constant behavior.

In simple terms: These values can be altered, which is unsafe.

Key Takeaway

Never reassign NaN or undefined.

Themes

Programming JavaScript variables

Mood

cautionary technical

Type

best‑practice warning

When to use this quote

  • Code reviews
  • static analysis
  • team coding standards

Key Concepts

Mutable globals language design runtime safety

Questions to Reflect On

  • Why were NaN and undefined designed as mutable?
  • What safeguards can prevent accidental changes?
A Different Perspective

Changing them can break libraries and cause bugs.

★ ★ ★ ★ ★ No ratings yet

More by Douglas Crockford

Explore all 33 Douglas Crockford quotes

More Technology quotes

Browse all 18,164 Technology quotes