includes (array)
  • 23 May 2023
  • Dark
    Light
  • PDF

includes (array)

  • Dark
    Light
  • PDF

Article summary

includes (array) Task Purpose

The arrayIncludes task is used to determine if an array includes a given element and then returns a "true" or "false" result, as appropriate. If used in conjunction with an index task, then you can specify where in the index the search should begin.

Potential Use Case

Suppose you have a list of emails and are looking to see if a certain address is in that list. You would specify the email address you want to find and if the email is present, then your result would come back as "true". If the email is not found in the list, then your result would come back as "false".

Properties

Incoming Type Description
arr Array Required. The array to search.
searchElement Any Required. The element to search for.
fromIndex Number Optional. The position in the array to begin searching for a searchElement. Default is 0 (zero).


Outgoing Type Description
result Boolean True if the searchElement is found within the array; false otherwise.

Example

In this IAP example:

  • The array is statically set and the reference variable is ["1","2","3"].

  • The searchElement to find is the number 2.

  • The fromIndex variable will default to 0.

  • The result will be True because the number 2 is listed in the array.

    includesArray


Was this article helpful?

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.