I have an array called Cards that on console log looks like
Array[3]
0: Object
1: Object
2: Object
each of these has a name: which I am using to reference it want to find it reference the obejct I have
var FoundInArray = [];
function CheckIndexArray(ArraySearch, array) {
var i;
for (i = 0; i < array.length; i++) {
if (array[i].name === ArraySearch) {
FoundInArray = array[i];
return true
break
} else {return false;} }
}
if (CheckIndexArray(document.getElementById("userInput").value, Cards) == true) {
console.log(FoundInArray);
the 3 names are ADAM, Arron Shamira, Adrian Omarsh this however only finds ADAM if I search the other two it doesn't find them. The question is why???