I have an array with 144 indexes, that I fill with data from a form. I want to check if a certain index contains a certain value, and I don't know if such function exists in JavaScript, or how to make said function.
Can you help me make a function that gets an array, a certain index and a certain value as parameters and return true if it exists?
An example:
var board = new Array();
board.push('X');
board.push('O');
function inArrayatindex(array, index, value)
{
/* if(certain code that i need help with...)
{
return true;
}
}
inArrayatindex(board, 2, 'O'); //returns true
inArrayatindex(board, 2, 'o'); // returns false
inArrayatindex(board, 3, 'X'); // returns false
array[index] === value?