Or, What it really means when people say “Everything in JavaScript is an object”

When you begin programming with JavaScript you might run across books, tutorials, and people who say “Everything in JavaScript is an object.” While it’s not 100% true (not everything is an object), it is mostly true. And sometimes this can be a bit surprising.

For instance, to most people functions and objects look and act completely different. And in many languages, functions and objects are completely different. However, in JavaScript, a function is an object. This can take a bit of concentrated attention to get your head around, but it’s an important concept because it’s the secret behind another big topic in JavaScript: functions as first class values.

And what about values like numbers, booleans and strings? One of the first things you learn when you pick up a book or tutorial on JavaScript is that these kinds of values are “primitive” values; in other words, they’re definitely not objects. And yet, you’ll quickly find out that in JavaScript, sometimes they are objects!

So bend your mind a bit, and immerse yourself in the world of objects to learn how, in JavaScript, (almost) everything is an object in this installment of Head First JavaScript Programming Teasers.

Previous Head First JavaScript Programming Teasers Episodes

We wrote the book: with over a 1,000,000 books sold, we’ve created some of the industries top-selling software & technology titles. We teach the experts: you find us teaching on today’s premier training sites, like Lynda.com and Safaribook’s Online, and we’ve created digital experiences for a small, but exceptional group of industry leaders and luminaries. Throughout it all, we’ve applied our wickedly smart philosophy to get you there faster with amazing results. How can we help you?

We wrote the book: with over a 1,000,000 books sold, we’ve created some of the industries top-selling software & technology titles. We teach the experts: you find us teaching on today’s premier training sites, like Lynda.com and Safaribook’s Online, and we’ve created digital experiences for a small, but exceptional group of industry leaders and luminaries. Throughout it all, we’ve applied our wickedly smart philosophy to get you there faster with amazing results. How can we help you?

Don't miss out!

Don't miss out on brain-friendly WickedlySmart updates early access to books and general cool stuff! Just give us your email and we'll send you something about once a week. 

You have Successfully Subscribed!