ArrayUtil - contains(Array array, Object element)

Searches the array for the element. Returns true if the element exists in the array, otherwise returns false.

Table 1. Parameters
Name Type Description
array Array The array to search
element Object The element to search for
Table 2. Returns
Type Description
Boolean True if the element is in the array, false otherwise.

var arrayUtil = new ArrayUtil();
var a1 = new Array("a", "b", "c");
gs.print("Contains b: " + arrayUtil.contains(a1, "b"));
gs.print("Contains x: " + arrayUtil.contains(a1, "x"));
Contains b: true
Contains x: false