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');
Comments
Can’t find what you need? Use the comment section below to connect with others, get answers from our experts, or share your ideas with us.
There are no comments yet.