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*

2
  • You also want to check that it isn't an array. so function isObject(obj) { return obj !== null && typeof obj === 'object' && !Array.isArray(obj); } Commented Apr 3, 2017 at 19:51
  • I agree with you, but as you see in the comment, it's how it's done in angularJs and I mention it in the comment in front of the function, they count the Array as an Object ... look at here for more information: docs.angularjs.org/api/ng/function/angular.isObject Commented Apr 4, 2017 at 0:50