Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript empty object check ES5

function isEmpty(obj) {
  for(var prop in obj) {
    if(Object.prototype.hasOwnProperty.call(obj, prop)) {
      return false;
    }
  }

  return JSON.stringify(obj) === JSON.stringify({});
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #empty #object #check
ADD COMMENT
Topic
Name
5+2 =