title: the loop (for) iteration throguh an array
body: <p>I made a simple program that works as a phone book. When a user types a name in the input field, the program searches an array of objects containing names and numbers and, if it finds the name, outputs name and phone number. If the name is not found, it lets the user know. However, when I type a name the result stays the same 'Name not found', even though the array contains given name. Here is the code</p>
  <pre><code>const phonebook = [
   {name : `Adam`, number : `001`},
   {name : `Anna`, number : `002`},
  ]
  
  const input = document.querySelector('input');
  const btn = document.querySelector('button');
  const para = document.querySelector('p');
  
  btn.addEventListener ('click', function () {
   let searchName = input.value.toLowerCase();
   input.value = '';
   input.focus();
  
   for (let i = 0; i &lt; phonebook.length; i++) {
       if (searchName === phonebook[i].name) {
           para.textContent = `${phonebook[i].name's number is ${phonebook[i].number}.`;
           break;
       } else {
           para.textContent = `Name not found in phonebook';
       }
  }
  });
  
  </code></pre>