tests whether an object contains any properties

Description

.isPlainObject() tests whether an object contains any properties, but must be of an Object instance. So an empty string will return false in this case:

Example


<!DOCTYPE html> 
<html>
<head> 
    <script src="http://yourServer.com/jQuery/jquery.min.js"></script> 
    <script> 
        console.log($.isPlainObject("")); // false
        console.log($.isPlainObject({})); // true
        console.log($.isPlainObject(new Object)); // true
    </script> 
</head> <!--from ww w  .  j a v a2s  .  com-->
<body> 
  <p>Your tags here</p>
</body> 
</html>

Click to view the demo





















Home »
  jQuery »
    jQuery Tutorial »




Basics
Selector
DOM
Event
Effect
Utilities