title: Updating Object Properties from inside an Array
body: <p>I know this is all basic stuff but it's all new to me so any help would be great. I'm trying to make a function that updates object properties, where the objects are all inside of an array. This is homework for my bootcamp I'm taking and this is what I got so far. I know the return needs to be outside of the loops scope, but I'm more hung up on the proper notation for the conditional statement and accessing and manipulating the object keys inside the array.</p>
  <pre class="lang-js prettyprint-override"><code>function findObject(array, key, target) {
    //look through the array by creating a for loop
  
    for (let i = 0; i &lt; array.length; i++) {
  
      //set conditional to check if an object in array has target value on its key prop
  
      if (array[i].key === target) {
  
        //if the above condition is met, return that object
        return array[i];
      }
  
    } //if its not return null
    return null;
  }
  </code></pre>
  <blockquote>
  <p>Prompt:3. Implement the function, findObject.
  Its parameters are:</p>
  <p>One Array called array<br />
  array is filled with Objects<br />
  One String called key<br />
  One String called target</p>
  <p>Look through array and return the object that has the target value on its key property</p>
  <p>Return null if target is not found</p>
  </blockquote>