Home > Web Front-end > JS Tutorial > jquery isEmptyObject function to determine whether it is an empty object_jquery

jquery isEmptyObject function to determine whether it is an empty object_jquery

WBOY
Release: 2016-05-16 18:10:48
Original
801 people have browsed it
Copy code The code is as follows:

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;
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template