jquery in array code example

Example 1: php in array

$colors = array("red", "blue", "green"); 
 
if (in_array("red", $colors)) { 
	echo "found red in array"; 
}

Example 2: javascript repeat element in array

Array(5).fill(2)
//=> [2, 2, 2, 2, 2]

Example 3: jquery in array

function isInArray(value, array) {
return array.indexOf(value) > -1;
}

Example 4: jquery check if value is in array

$.inArray( 5 + 5, [ "8", "9", "10", 10 + "" ] );

Example 5: js inarray

array.includes(élémentRecherché)
array.includes(élémentRecherché, indiceDépart)