angularjs - Javascript If condition to check a variable with empty object or not -
i have variable var = {};
if ( !==null) { // entering here if var has empty object don't want enter. } if (a == null) { // want enter condition if var has empty object. } i have tried several ways write condition giving a=={} still entering first condition. please let me know appropriate way check condition?
first option
var = null; second option
if ( !==null && json.stringify(a) !== '{}') {..}
Comments
Post a Comment