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
  • 1
    this is the best way but I would make it even easier by on the 2nd line: return Object.prototype.toString.call(n) === '[object Object]' Commented Jun 10, 2018 at 4:19
  • 1
    You can also remove the null check, because Object.prototype.toString.call(null) === '[object Null]' Commented Nov 6, 2019 at 0:02