objectHasOwnProperty
  • 18 Oct 2024
  • Dark
    Light
  • PDF

objectHasOwnProperty

  • Dark
    Light
  • PDF

Article summary

objectHasOwnProperty Task Purpose

The objectHasOwnProperty task is used to check whether the object has a specified property as its own property. This is useful for checking if the object has inherited the property rather than being its own.

The result returns a boolean value (True or False) indicating whether the object has the given property as its own property. If the object has a property with the name contained in the string argument, it returns true. Otherwise it returns false.

Potential Use Case

This task is a convenient method to check if a specific property exists in an object (or not) since it returns true/false accordingly. Using this task also allows you to test for properties you have manually created on your current object.

Another benefit of objecthasOwnProperty is that it can be initialized with any object by just using the string as an argument. It returns true if the value is available to the object, or it returns false. Lastly, if you just want to check for the existence of properties, and not necessarily what their value might be, then you could use this task.

Properties

Input and output properties are shown below.

Input Type Description
obj Object Required. The object to test.
prop String Required. The string that contains the property to check.


Output Type Description
result Boolean The result is true if the object owns the specified property; false otherwise.

Example 1

In this IAP example, the incoming Reference variable for prop is "name" and the outgoing result returns "True", indicating the object contains the specified property.

objectHasOwnProp-01

objectHasOwnProp-02

Example 2

In this IAP example, the incoming Reference variable for prop is "type" and the result returns "False", indicating the object does not contain that given property.

objectHasOwnProp-03

objectHasOwnProp-04


Was this article helpful?

What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.