Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Array.contains Function

Array.contains Function

.NET Framework 3.5

Determines whether the specified object exists as an element in an Array object. This function is static and can be invoked without creating an instance of the object.

var itemExists = Array.contains(array, item);

Term

Definition

array

The array to search.

item

The object to find in the array.

true if the specified object exists as an element in the array; otherwise, false.

Use the contains function to determine whether a specified object exists as element in an Array object.

In Mozilla Firefox, calling the contains function with item set to undefined returns true if an item in the array has been set to undefined. In all other browsers, the function returns false in these circumstances.

The following example shows how to use the contains function to determine whether an array contains a specified element.

Community Additions

ADD
Show:
© 2015 Microsoft