while case is the fastest
function contains(arr, str) { var i = arr.length; while (i--) { if (arr[i] === str) { return true; } } return false; }
For more information on using js to determine whether an array contains a certain element (similar to in_array() in php), please pay attention to the PHP Chinese website for related articles!