$item) { if ($key == $keySearch) Check for existence of key in multidimensional array in javascript - Stack Overflow. An example would be key "c" in the following Object. The arr2.indexOf(x) method searches arr2 and returns the position of the first occurrence of arr1. Works to determine if the key is set at all - and will return TRUE even if the value of the "action" key is NULL. This tutorial shows you to check if an array contain a value, being a primtive value or object. Or it can be an object. It treats “Lemon” and “lemon” as different values. Searching in a One-Dimensional Array. If you need to check if value exists in jquery array then you can do it using jquery inarray function. Using for loop