Operators
Property presence operator (in)
Checks whether a property exists in an object or its prototype chain. It does not test the property value or array membership by value. A nonobject right operand throws TypeError.
Formal Syntax & Structure
javascript syntaxjavascript
key in objectParameters & Attributes
| Name | Type | Description |
|---|---|---|
| key | property key | Property name or symbol. |
| object | Object | Object to inspect. |
Return Value
boolean
Whether the property exists.
Working Example
Example Snippetjavascript
const a={count:undefined};console.log("count" in a,"missing" in a);