Object.has_key
Object.has_key
Function
Determine whether the specified key exists in the object.
Syntax
object.has_key(key)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| key | Any | No | '' | The key name to be checked will be converted to a string first when called. |
Return value
| Type | Description |
|---|---|
| Bool | Returns true if the key exists, false otherwise. |
Example
user = {name: 'BT'} result = user.has_key('name') // Output: true print result
Notes
- Only checks the current object's own keys.