📝

javascript empty object check

https://stackoverflow.com/questions/679915/how-do-i-test-for-an-empty-javascript-object function isEmpty ( obj ) { for ( var prop in obj ) { if ( obj . has

SDK · · 294 자
https://stackoverflow.com/questions/679915/how-do-i-test-for-an-empty-javascript-object  
function isEmpty(obj) {
    for(var prop in obj) {
        if(obj.hasOwnProperty(prop))
            return false;
    }

    return JSON.stringify(obj) === JSON.stringify({});
}
  JS
jQuery.isEmptyObject({}); // true