Model Object
hasProperty()
Signature
Section titled “Signature”hasProperty() — returns boolean
Available in: model
Category: Miscellaneous Functions
Description
Section titled “Description”Returns true if the specified property name exists on the model.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
property | string | yes | — | Name of property to inspect. |
Examples
Section titled “Examples”// Get an object, set a value and then see if the property exists
employee = model("employee").new();
employee.firstName = "dude";
employee.hasProperty("firstName"); // returns true
// This is also a dynamic method that you could do
employee.hasFirstName();