for (let i = 0; i < bound; i++) {
if (condition1) {
return "something";
} else if (condition2) {
return "something else";
} else if (condition3) {
return "something other else";
}
}
As soon as you meet one of the three conditions, you return from the function and stop executing the loop. This is causing your loop to behave differently that you expect.
Right, but that means that you return “No such contact” the first time you find a contact that does not have a matching name, which means that you have not checked the full contact list with your for loop.