Skip to content

Model Object

hasProperty()

hasProperty() — returns boolean

Available in: model Category: Miscellaneous Functions

Returns true if the specified property name exists on the model.

NameTypeRequiredDefaultDescription
propertystringyesName of property to inspect.
// 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();