in

The in operator returns true if the specified property is in the specified object.

Syntax

propNameOrNumber in objectName

Parameters

Parameter Description
propNameOrNumber A string or numeric expression representing a property name or array index.
objectName Name of an object.

Description

The following examples show some uses of the in operator.

Using in with deleted or undefined properties

If you delete a property with the delete operator, the in operator returns false for that property.

If you set a property to undefined but do not delete it, the in operator returns true for that property.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.