To check in JavaScript if a value exists at a certain array index, we use check if the array item at the index is undefined or not.
For instance, we write
if (arrayName[index]) {
//...
}
to get the item in arrayName at index.
If it’s not undefined, then the value exists.