isEmptyObject: function( obj ) {
for ( var name in obj ) {
return false;
}
return true;
}
Analysis:
1. What is an object: In fact, in javascript, an object is A set of "key/value" combinations, to put it bluntly, it is a data set, representing attributes and methods
jQuery determines whether an object is empty by using for name in obj to traverse the attribute names in the object. If an object has an attribute name Then run return false to return the result and exit the loop; otherwise, run return true;