How to assign a nested property of an object given an array of keys : <p>I have an object that resembles this:</p>

<pre><code>const obj = {
   prop1: {
      prop2: {
         value: 'something',
         ...otherProps
      }
   },
   ...otherProps
}
</code></pre>

<p>And an array that looks like this:</p>

<pre><code>const history = ['prop1', 'prop2', 'value']
</code></pre>

<p>How do I assign the property <code>value</code> of <code>prop2</code> a new value in a way that would also work for any other depth. </p>
