Ghost Together
2 min readFeb 10, 2019

--

Hey, thanks for the article. I actually gained a few insights from it. However…

An instance of an object is the only thing we can refer to as an object.

Perhaps {} literal is also qualified for such distinction!

I am not sure but I think you may be referring to some primitive literal values when you say: “Except for numbers, strings, and boolean, everything in JavaScript is an object.” Well, it seems like there may be a lot more things that are not objects upon a closer examination: null is not an object. undefined is not an object. An arrow function is not an object. (Although an ES5 function is at the very least an object constructor) JSON is not a (first-class) object (also, it has no constructor — which probably should be the basis of trying to discern whether something is an object or not.)

It came as odd thing to read because Number, String and Boolean are actually the only 3 primitive object constructor functions.

We have to be more carful about these types of things, I think. Because as the language evolves, the object/not an object line is starting to be more difficult to draw without blurring at the edges!

I think it is fair to say that literal value don’t appear to be objects until you call method on them. But that’s somewhat of a special case and they all have constructor functions associated with them.

It used to be popular to say “Everything is an object in JavaScript” a decade ago. Then it became “Almost everything is an object.” (There are different manifestations of the phrase.) But in ES6+ even arrow function — a key language feature — is not an object. Times are changing.

--

--

Ghost Together
Ghost Together

Written by Ghost Together

Ghost Together @ https://semicolon.dev is an alternative to Twitter. Sign up to meet other makers of things.

No responses yet