javascript check if key exists in array