Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

10
  • 5
    A variable is a variable. It may refer to an object. Also, you may want to define "object" - as the answers and comments show, there are various conflicting definitions (e.g. whether null is an object). Commented Dec 14, 2011 at 20:46
  • 9
    OP, IMO you should accept @Daan's answer as it is the best solution and should be listed above other answers so it is seen first. (No offense to others who also have good answers.) Commented Nov 17, 2015 at 21:11
  • 3
    IMHO it really depends on what you (the one seeking for an answer to this question) consider an Object, and why you are checking it. This question gives different answers if you are trying to distinguish Arrays (that are Objects) from other Objects or if you are trying to separate scalar values from "vectors". And whether null (that is an Object, according to typeof) or Functions (that are Objects) should be excluded or not, it really depends on why you are checking it. That's why there are so many answers and most of them, in context, are correct. Commented Feb 8, 2017 at 11:52
  • 1
    It would be great if you could start by saying what exactly you mean by "is an Object". (Or, say explicitly that part of the answer you're seeking is to nail down various popular meanings of "is an object" and then differentiate between them.) Lacking that, everyone is talking past each other. Commented Dec 26, 2019 at 13:43
  • 1
    @tiffon How about a to the point answer at stackoverflow.com/a/52478680/1096194. I wrote this when I was overwhelmed by seeing the length of detail in many of the highest voted answers. I believe it deserves a lot more visibility. Commented Jun 8, 2020 at 10:40