title: Replacing a whole object within a specific array index with another object
body: <p>I have the following javascript object:</p>
  <pre><code>const myValidation = [
     {
         id:'1', name:'qqq', field1: 'Yes', field2: 'No', field3: 'Yes'
     }, 
     {
         id:'330', name:'www', field1: 'Yes', field2: 'Yes'
     }, 
     {
         id:'45', name:'eee', field1: 'Yes' 
     }
  ]
  </code></pre>
  <p>Based on some condition within my code and if it's <code>true</code>, I want to replace <code>myValidation[1]</code> index object with the following object and it will always be at array index 1:</p>
  <pre><code>const newObj = {
             id:'331', name:'tom', field1: 'Yes', field2: 'Yes', field3: 'Yes', field4: 'Yes'
        }
  </code></pre>
  <p>So after replacing the object, <code>myValidation</code> array now looks like:</p>
  <pre><code>const myValidation = [
     {
         id:'1', name:'qqq', field1: 'Yes', field2: 'No', field3: 'Yes'
     }, 
     {
         id:'331', name:'tom', field1: 'Yes', field2: 'Yes', field3: 'Yes', field4: 'Yes'
     }, 
     {
         id:'45', name:'eee', field1: 'Yes' 
     }
  ]
  </code></pre>
  <p>Please note that I don't want to match on ids or any other key, I purely want to replace an object with another object at <code>myValidation[1]</code> index.</p>
  <p>Unsure how to achieve this.</p>