If typeof x === 'object', x is an object (except a function) or null. If you want null, arrays, and functions to be excluded, just make it:
Copytypeof x === 'object' && !Array.isArray(x) && x !== null
Answer from Chuck on Stack OverflowVideos
If typeof x === 'object', x is an object (except a function) or null. If you want null, arrays, and functions to be excluded, just make it:
Copytypeof x === 'object' && !Array.isArray(x) && x !== null
UPDATE:
This answer is incomplete and gives misleading results. For example, null is also considered of type object in JavaScript, not to mention several other edge cases. Follow the recommendation below and move on to other "most upvoted (and correct!) answer":
Copytypeof yourVariable === 'object' && yourVariable !== null
Original answer:
Try using typeof(var) and/or var instanceof something.
EDIT: This answer gives an idea of how to examine variable's properties, but it is not a bulletproof recipe (after all there's no recipe at all!) for checking whether it's an object, far from it. Since people tend to look for something to copy from here without doing any research, I'd highly recommend that they turn to the other, most upvoted (and correct!) answer.