![]() |
VOOZH | about |
JavaScript in operator is an inbuilt operator which is used to check whether a particular property exists in an object or not. It returns a boolean value true if the specified property is in an object, otherwise, it returns false.
true false true
prop in object
Here are some examples of using the in operator:
Example: Using the in Operator to Check Indexes and Properties in an Array.
true true false false false true
Example: Using the in Operator to Check the Existence of Properties in an Object.
true false GEEKSFORGEEKS
This method returns a boolean value. The value true is returned if the specified property is found in an object, else it returns false.