Empty JS Object
javascript, json
Solution
If you're looking for a one-liner, consider `Object.keys`:
var isEmpty = !Object.keys(obj).length;
Your current method is dangerous, since it will always return false when `Object.prototype` has been extended: http://jsfiddle.net/Neppc/
Problem
Is there a better way to check if an object is empty? I'm using this: ``` function isObjEmpty(obj) { for (var p in obj) return false; return true; } ```