inArray

Check that the array contains the given element.

Description

vcc.inArray(array: any[], element: any): boolean

Searches array for element and returns true if successful.

Parameters

array
We look for the element within this array.

element
We look for this element within the array.

Return values

Returns true if the element is found in the array, false otherwise.

Example

In most situations using vcc.isSelected is a good solution, but suppose that we have a list of postal codes and we have to look for the given one.

var allowedValues = ['2034', '2579', '1069', '5173'];
vcc.alert(vcc.inArray(allowedValues, '1069') ? 'found' : 'not found');
vcc.alert(vcc.inArray(allowedValues, '2000') ? 'found' : 'not found');

There are no comments yet.

Comment

Subscribe to our newsletter
or Contact us!