Function to check whether a given array key exists in the array. This function is taken from php.js.
var key = "myKey"; if(array_key_exists(key, array)) { //Do something if the key exists in the array. }
Parameter | Data type | Required | Description |
---|---|---|---|
key | string / number | Yes | The key to search for |
search | array | Yes | The array to search |
Value | Meaning |
---|---|
true | The key exists in the given array |
false | The key does not exist in the given array |