---
title: "arrayElementExists"
canonical: "https://support.appfire.com/space/PSCONF/15302840/arrayElementExists"
format: markdown
---
> Macro (aura-html)

> Macro (table-plus)
> 
> |  |  |  |  |
> | --- | --- | --- | --- |
> | **Syntax** | arrayElementExists(array, elem) | **Package** | array |
> | **Alias** | elementExists (array, elem) | **Pkg Usage** | elementExists(array, elem) |

## Description

> Macro (excerpt)
> 
> Returns "true" if the element exists in the array and "false" otherwise.

Returns "true" if the element exists in the array and "false" otherwise.

## Parameters

> Macro (table-plus)
> 
> | Parameter name | Type | Required | Description |
> | --- | --- | --- | --- |
> | array | Array | Yes | Array where the element existence is checked. |
> | element | Any | Yes | Element the existence is checked for. |

## Return Type

**Boolean**

## Example

```javascript
if( elementExists(watchers, currentUser()) ){
    print("You are watching this issue.");
}
```

The routine returns "true" if **currentUser** is in the **watchers** array and if the result is "true" a message is printed.

> ⚠️ If **elem** is not the same type as declared in the array definition, the routine returns "error".

## See also

> Macro (contentbylabel)