jQuery isEmptyObject() method

The isEmptyObject() method is used to determine whether the passed argument is an empty object or not. It returns a Boolean value.

If it finds the passed value is an empty object, it returns true. Otherwise, it returns false. A plain object is created using the "{}" or by using "new Object". So, the isEmptyObject() method returns true if the objects are empty and are created using the "{}" or by using the "new Object()".

We can use the $. isPlainObject() to check whether an object is a plain JavaScript object or not.

Syntax

The commonly used syntax of this method is given below -

This method accepts a single parameter, which is defined as follows -

obj - It is the object to be checked to see whether it is an empty object or not.

Let's understand the working of the isEmptyObject() method, using some illustrations.

Example1

In this example, we are using the isEmptyObject() method to determine whether the passed value is an Empty object or not. Here, we are passing different values such as {}, Object, etc. as an argument.

Test it Now

Output

After the execution of the above code, the output will be -

jQuery isEmptyObject() method

Example2

Here, we are passing array and string as the argument of the isEmptyObject() method to check whether the method return true or false.

Test it Now

Output

jQuery isEmptyObject() method




Contact US

Email:[email protected]

isEmptyObject() method
10/30