---
title: "Meaning & Key Takeaway of: undefined and NaN are not constants. They…"
description: "\"“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 ..."
image: "https://sms4smile.com/quotes/i/4f8/douglas-crockford-19095_technology_undefined-and-nan-are-not-constants-they_1258135.jpg"
---

#  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](https://sms4smile.com/quotes/i/4f8/douglas-crockford-19095_technology_undefined-and-nan-are-not-constants-they_1258135.jpg)   [Download](https://sms4smile.com/quotes/i/4f8/douglas-crockford-19095_technology_undefined-and-nan-are-not-constants-they_1258135.jpg) [Open image](https://sms4smile.com/quotes/i/4f8/douglas-crockford-19095_technology_undefined-and-nan-are-not-constants-they_1258135.jpg)

> ““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](https://sms4smile.com/quotes/author/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

[Technology](https://sms4smile.com/quotes/about/technology/)

## Related quotes

> [“When you link to multiple JavaScript files from your page, all the global variables are defined in the same global space.”](https://sms4smile.com/quotes/eric-freeman/when-you-link-to-multiple-javascript-files-from-your-page-all-the/)

[Eric Freeman](https://sms4smile.com/quotes/author/eric-freeman/)

> [“the road to programming hell is paved with global variables,”](https://sms4smile.com/quotes/steve-mcconnell/the-road-to-programming-hell-is-paved-with-global-variables/)

[Steve McConnell](https://sms4smile.com/quotes/author/steve-mcconnell/)

> [Don't ask where the rest of this book is!" It is a shrill cry that comes from an undefined spot among the shelves. "All…](https://sms4smile.com/quotes/italo-calvino/don-t-ask-where-the-rest-of-this-book-is-it-is-a-shrill-cry-that/)

[Italo Calvino](https://sms4smile.com/quotes/author/italo-calvino/)

> [You can't make either life or art, you have to work in the hole in between, which is undefined. That's what makes the adventure…](https://sms4smile.com/quotes/robert-rauschenberg/you-can-t-make-either-life-or-art-you-have-to-work-in-the-hole-in/)

[Robert Rauschenberg](https://sms4smile.com/quotes/author/robert-rauschenberg/)

> [The true self seeks release, not constraint. It doesnt want to be corseted in a sonnet or made to learn a system of musical…](https://sms4smile.com/quotes/rachel-cusk/the-true-self-seeks-release-not-constraint-it-doesnt-want-to-be/)

[Rachel Cusk](https://sms4smile.com/quotes/author/rachel-cusk/)

> [First ladies are doing a lot. But the job remains undefined, frequently misunderstood, and subject to political attacks far nastier in some ways than…](https://sms4smile.com/quotes/margaret-truman-daniel/first-ladies-are-doing-a-lot-but-the-job-remains-undefined-frequently/)

[Margaret Truman Daniel](https://sms4smile.com/quotes/author/margaret-truman-daniel/)

> [The Constitution of the United States was made not merely for the generation that then existed, but for posterity- unlimited, undefined, endless, perpetual posterity.](https://sms4smile.com/quotes/henry-clay/the-constitution-of-the-united-states-was-made-not-merely-for-the/)

[Henry Clay](https://sms4smile.com/quotes/author/henry-clay/)

> [And yet what is Modernism? It is undefined.](https://sms4smile.com/quotes/john-crowe-ransom/and-yet-what-is-modernism-it-is-undefined/)

[John Crowe Ransom](https://sms4smile.com/quotes/author/john-crowe-ransom/)

> [I want out of the labels. I don't want my whole life crammed into a single word. A story. I want to find something…](https://sms4smile.com/quotes/chuck-palahniuk/i-want-out-of-the-labels-i-don-t-want-my-whole-life-crammed-into-a-2/)

[Chuck Palahniuk](https://sms4smile.com/quotes/author/chuck-palahniuk/)

> [What demon is our god? What name subsumes That act external to our sleeping selves? Not pleasure - it is much too broad and…](https://sms4smile.com/quotes/j-v-cunningham/what-demon-is-our-god-what-name-subsumes-that-act-external-to-our/)

[J. V. Cunningham](https://sms4smile.com/quotes/author/j-v-cunningham/)

> [Anaximenes ... also says that the underlying nature is one and infinite ... but not undefined as Anaximander said but definite, for he identifies…](https://sms4smile.com/quotes/theophrastus/anaximenes-also-says-that-the-underlying-nature-is-one-and-infinite/)

[Theophrastus](https://sms4smile.com/quotes/author/theophrastus/)

> [Uncharged with invisible meaning, the visible is nothing, mere clay; and without visible circumstance, a territory, to connect to, our spirit is shapeless, nameless,…](https://sms4smile.com/quotes/e-l-doctorow/uncharged-with-invisible-meaning-the-visible-is-nothing-mere-clay-and/)

[E. L. Doctorow](https://sms4smile.com/quotes/author/e-l-doctorow/)

> [A modern democracy is a tyranny whose borders are undefined; one discovers how far one can go only by traveling in a straight line…](https://sms4smile.com/quotes/norman-mailer/a-modern-democracy-is-a-tyranny-whose-borders-are-undefined-one/)

[Norman Mailer](https://sms4smile.com/quotes/author/norman-mailer/)

> [An island always pleases my imagination, even the smallest, as a small continent and integral portion of the globe. I have a fancyfor building…](https://sms4smile.com/quotes/henry-david-thoreau/an-island-always-pleases-my-imagination-even-the-smallest-as-a-small/)

[Henry David Thoreau](https://sms4smile.com/quotes/author/henry-david-thoreau/)

> [Even the most abject have a sense of superiority based on powerful though undefined merits.](https://sms4smile.com/quotes/mason-cooley/even-the-most-abject-have-a-sense-of-superiority-based-on-powerful/)

[Mason Cooley](https://sms4smile.com/quotes/author/mason-cooley/)

## More by Douglas Crockford

> [Progress comes from finding better ways to do things. Don't be afraid of innovation. Don't be afraid of ideas that are not your own.](https://sms4smile.com/quotes/douglas-crockford/progress-comes-from-finding-better-ways-to-do-things-don-t-be-afraid/)

[Douglas Crockford](https://sms4smile.com/quotes/author/douglas-crockford/)

> [“If you want to learn more about the bad parts and how to use them badly, consult any other JavaScript book.”](https://sms4smile.com/quotes/douglas-crockford/if-you-want-to-learn-more-about-the-bad-parts-and-how-to-use-them/)

[Douglas Crockford](https://sms4smile.com/quotes/author/douglas-crockford/)

> [JavaScript is the only language that I'm aware of that people feel they don't need to learn before they start using it.](https://sms4smile.com/quotes/douglas-crockford/javascript-is-the-only-language-that-i-m-aware-of-that-people-feel/)

[Douglas Crockford](https://sms4smile.com/quotes/author/douglas-crockford/)

> [Most programming languages contain good parts and bad parts. I discovered that I could be better programmer by using only the good parts and…](https://sms4smile.com/quotes/douglas-crockford/most-programming-languages-contain-good-parts-and-bad-parts-i/)

[Douglas Crockford](https://sms4smile.com/quotes/author/douglas-crockford/)

> [ “suppress empty strings in the output array when the separator is a regular expression: var f = '\|a\|b\|c\|'.split(/\\\|/); // f is \['a', 'b', 'c'\]… ](https://sms4smile.com/quotes/douglas-crockford/suppress-empty-strings-in-the-output-array-when-the-separator-is-a/)

[Douglas Crockford](https://sms4smile.com/quotes/author/douglas-crockford/)

> [People who use Class will never understand all the crap they are doing.](https://sms4smile.com/quotes/douglas-crockford/people-who-use-class-will-never-understand-all-the-crap-they-are-doing/)

[Douglas Crockford](https://sms4smile.com/quotes/author/douglas-crockford/)

> [“Few classical programmers found prototypal inheritance to be acceptable, and classically inspired syntax obscures the language’s true prototypal nature. It is the worst of…](https://sms4smile.com/quotes/douglas-crockford/few-classical-programmers-found-prototypal-inheritance-to-be/)

[Douglas Crockford](https://sms4smile.com/quotes/author/douglas-crockford/)

> [Computer programs are the most complex things that humans make.](https://sms4smile.com/quotes/douglas-crockford/computer-programs-are-the-most-complex-things-that-humans-make/)

[Douglas Crockford](https://sms4smile.com/quotes/author/douglas-crockford/)

> [The good thing about reinventing the wheel is that you can get a round one.](https://sms4smile.com/quotes/douglas-crockford/the-good-thing-about-reinventing-the-wheel-is-that-you-can-get-a/)

[Douglas Crockford](https://sms4smile.com/quotes/author/douglas-crockford/)

> [Good architecture is necessary to give programs enough structure to be able to grow large without collapsing into a puddle of confusion.](https://sms4smile.com/quotes/douglas-crockford/good-architecture-is-necessary-to-give-programs-enough-structure-to/)

[Douglas Crockford](https://sms4smile.com/quotes/author/douglas-crockford/)

> [Programmers are as emotional and irrational as normal people](https://sms4smile.com/quotes/douglas-crockford/programmers-are-as-emotional-and-irrational-as-normal-people/)

[Douglas Crockford](https://sms4smile.com/quotes/author/douglas-crockford/)

> [Generally, the craft of programming is the factoring of a set of requirements into a a set of functions and data structures.](https://sms4smile.com/quotes/douglas-crockford/generally-the-craft-of-programming-is-the-factoring-of-a-set-of/)

[Douglas Crockford](https://sms4smile.com/quotes/author/douglas-crockford/)

> [I have been writing JavaScript for 8 years now, and I have never once found need to use an uber function. The super idea…](https://sms4smile.com/quotes/douglas-crockford/i-have-been-writing-javascript-for-8-years-now-and-i-have-never-once/)

[Douglas Crockford](https://sms4smile.com/quotes/author/douglas-crockford/)

> [Things don't change because people change their minds. They change because they retire or die.](https://sms4smile.com/quotes/douglas-crockford/things-don-t-change-because-people-change-their-minds-they-change/)

[Douglas Crockford](https://sms4smile.com/quotes/author/douglas-crockford/)

> [It turns out that strong typing does not eliminate the need for careful testing. And I have found in my work that the sorts…](https://sms4smile.com/quotes/douglas-crockford/it-turns-out-that-strong-typing-does-not-eliminate-the-need-for/)

[Douglas Crockford](https://sms4smile.com/quotes/author/douglas-crockford/)

[Explore all 33 Douglas Crockford quotes ](https://sms4smile.com/quotes/author/douglas-crockford/)

## More Technology quotes

> [But we are convinced that if we are to play a meaningful role nationally, and in the community of nations, we must be second…](https://sms4smile.com/quotes/vikram-sarabhai/but-we-are-convinced-that-if-we-are-to-play-a-meaningful-role/)

[Vikram Sarabhai](https://sms4smile.com/quotes/author/vikram-sarabhai/)

> [“This story is not at all an uncommon one in tech circles, including gaming. The popular notion is that women who get ahead must…](https://sms4smile.com/quotes/bailey-poland/this-story-is-not-at-all-an-uncommon-one-in-tech-circles-including/)

[Bailey Poland](https://sms4smile.com/quotes/author/bailey-poland/)

> [The time that one gains cannot be accumulated in a storehouse; it is contradictory to want to save up existence, which, the fact is,…](https://sms4smile.com/quotes/simone-de-beauvoir/the-time-that-one-gains-cannot-be-accumulated-in-a-storehouse-it-is/)

[Simone de Beauvoir](https://sms4smile.com/quotes/author/simone-de-beauvoir/)

> [“The metaprogrammer who uses one, or especially several, applications as components in a larger system. This is the user whose needs are poorly met…](https://sms4smile.com/quotes/frederick-p-brooks-jr/the-metaprogrammer-who-uses-one-or-especially-several-applications-as/)

[Frederick P. Brooks Jr](https://sms4smile.com/quotes/author/frederick-p-brooks-jr/)

> [Advances in technology will continue to reach far into every sector of our economy. Future job and economic growth in industry, defense, transportation, agriculture,…](https://sms4smile.com/quotes/christopher-bond/advances-in-technology-will-continue-to-reach-far-into-every-sector/)

[Christopher Bond](https://sms4smile.com/quotes/author/christopher-bond/)

> [“Economic growth continued by means of a succession of new products which found growing and ultimately massive demand. Some of the new products were…](https://sms4smile.com/quotes/edward-a-hudson/economic-growth-continued-by-means-of-a-succession-of-new-products/)

[Edward A. Hudson](https://sms4smile.com/quotes/author/edward-a-hudson/)

> [I had an idea for a technologically advanced luxury watch. I got involved in digital art and neon painting and put on shows of…](https://sms4smile.com/quotes/giorgio-moroder/i-had-an-idea-for-a-technologically-advanced-luxury-watch-i-got/)

[Giorgio Moroder](https://sms4smile.com/quotes/author/giorgio-moroder/)

> [What it comes down to for me is this: Will the technologies of communication in our culture, serve to enlighten us and help us…](https://sms4smile.com/quotes/roger-waters/what-it-comes-down-to-for-me-is-this-will-the-technologies-of/)

[Roger Waters](https://sms4smile.com/quotes/author/roger-waters/)

> [The display is the computer.](https://sms4smile.com/quotes/jen-hsun-huang/the-display-is-the-computer/)

Jen-Hsun Huang

> [We became Homo sapiens not that long ago, from the scientific perspective, and we've retained a lot of our beast nature. We've done all…](https://sms4smile.com/quotes/wangechi-mutu/we-became-homo-sapiens-not-that-long-ago-from-the-scientific/)

[Wangechi Mutu](https://sms4smile.com/quotes/author/wangechi-mutu/)

> [The reason that Apple is able to create products like iPad is because we always try to be at the intersection of technology and…](https://sms4smile.com/quotes/steve-jobs/the-reason-that-apple-is-able-to-create-products-like-ipad-is-because/)

[Steve Jobs](https://sms4smile.com/quotes/author/steve-jobs/)

> [I just feel like everybody stays on their phone nowadays. People will go to a party and everybody is on their phone, and you…](https://sms4smile.com/quotes/snow-tha-product/i-just-feel-like-everybody-stays-on-their-phone-nowadays-people-will/)

[Snow Tha Product](https://sms4smile.com/quotes/author/snow-tha-product/)

> [“If Amazon’s dream of a world without gatekeepers becomes reality, then the company itself will become a powerful gatekeeper.”](https://sms4smile.com/quotes/evgeny-morozov/if-amazon-s-dream-of-a-world-without-gatekeepers-becomes-reality-then/)

[Evgeny Morozov](https://sms4smile.com/quotes/author/evgeny-morozov/)

> [Real breakthroughs are not found because you want to develop some new technology, but because you are curious and want to find out how…](https://sms4smile.com/quotes/anton-zeilinger/real-breakthroughs-are-not-found-because-you-want-to-develop-some-new/)

[Anton Zeilinger](https://sms4smile.com/quotes/author/anton-zeilinger/)

> [The most fundamental question we can ever ask ourselves is whether or not the universe we live in is friendly or hostile.](https://sms4smile.com/quotes/albert-einstein/the-most-fundamental-question-we-can-ever-ask-ourselves-is-whether-or/)

[Albert Einstein](https://sms4smile.com/quotes/author/albert-einstein/)

[Browse all 18,164 Technology quotes ](https://sms4smile.com/quotes/about/technology/)

```json
{
    "@context": "https://schema.org",
    "@graph": [
        {
            "@type": "Quotation",
            "text": "“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.”",
            "creator": {
                "@type": "Person",
                "name": "Douglas Crockford"
            },
            "isPartOf": {
                "@id": "https://sms4smile.com/quotes/#website"
            },
            "url": "https://sms4smile.com/quotes/douglas-crockford/undefined-and-nan-are-not-constants-they-are-global-variables-and-you/",
            "about": {
                "@type": "Thing",
                "name": "Technology"
            },
            "@id": "https://sms4smile.com/quotes/douglas-crockford/undefined-and-nan-are-not-constants-they-are-global-variables-and-you/#quotation",
            "image": {
                "@type": "ImageObject",
                "@id": "https://sms4smile.com/quotes/i/4f8/douglas-crockford-19095_technology_undefined-and-nan-are-not-constants-they_1258135.jpg",
                "contentUrl": "https://sms4smile.com/quotes/i/4f8/douglas-crockford-19095_technology_undefined-and-nan-are-not-constants-they_1258135.jpg",
                "url": "https://sms4smile.com/quotes/i/4f8/douglas-crockford-19095_technology_undefined-and-nan-are-not-constants-they_1258135.jpg",
                "width": 1080,
                "height": 1080,
                "caption": "“undefined and NaN are not constants. They are global variables, and you can change their values. That should…” — Douglas Crockford",
                "creditText": "SMS4Smile Quotes",
                "creator": {
                    "@id": "https://sms4smile.com/quotes/#organization"
                }
            }
        },
        {
            "@type": "BreadcrumbList",
            "itemListElement": [
                {
                    "@type": "ListItem",
                    "position": 1,
                    "name": "Home",
                    "item": "https://sms4smile.com/"
                },
                {
                    "@type": "ListItem",
                    "position": 2,
                    "name": "Quotes",
                    "item": "https://sms4smile.com/quotes/"
                },
                {
                    "@type": "ListItem",
                    "position": 3,
                    "name": "Douglas Crockford",
                    "item": "https://sms4smile.com/quotes/author/douglas-crockford/"
                },
                {
                    "@type": "ListItem",
                    "position": 4,
                    "name": "“undefined and NaN are not constants....",
                    "item": "https://sms4smile.com/quotes/douglas-crockford/undefined-and-nan-are-not-constants-they-are-global-variables-and-you/"
                }
            ],
            "@id": "https://sms4smile.com/quotes/douglas-crockford/undefined-and-nan-are-not-constants-they-are-global-variables-and-you/#breadcrumb"
        },
        {
            "@type": "WebSite",
            "@id": "https://sms4smile.com/quotes/#website",
            "name": "SMS4Smile Quotes",
            "url": "https://sms4smile.com/quotes/",
            "publisher": {
                "@id": "https://sms4smile.com/quotes/#organization"
            }
        },
        {
            "@type": "Organization",
            "@id": "https://sms4smile.com/quotes/#organization",
            "name": "SMS4Smile Quotes",
            "url": "https://sms4smile.com/quotes/",
            "logo": {
                "@type": "ImageObject",
                "url": "https://sms4smile.com/quotes/wp-content/themes/sq/assets/icons/icon-512.png",
                "width": 512,
                "height": 512
            }
        }
    ]
}
```
