I'm looking to check if an object is just a simple {} with key:value pairs and not a function, array, string number and so on. Is this possible?
Asked
Active
Viewed 31 times
0
-
3You can do this [with `typeof`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof) (although watch out for `null`). – James Donnelly Oct 09 '17 at 13:51
-
`Object.getPrototypeOf(x) == Object.prototype` should do it, however I'm not sure *why* you want to check this. – Bergi Oct 09 '17 at 14:14