Can anyone tell me why this code would not work? I’ve found examples using google that are similar, but this code doesn’t do either of the branches (true or false). It just poops out. I know that there is data in the array because I can display them sequentially if I want to.
It’s using a two dimensional array and I want to display one of the values.
Code:
findValue(array, ‘Selection1’)
function findValue(arrayObj, searchFor)
{
for (i=0;i<arrayObj.length;i++)
{
var found = false
if (arrayObj[i][0] == searchFor)
{
document.write(arrayObj[i][0])
var found = true
return true
break
}
else if (((i == (arrayObj.length-1)) && !found)){
document.write(“Not found!”)
return false
}
}
}