title: JavaScript - spread and rest syntax to remove specific property from object
body: <p>I have an object as follows :</p>
  
  <pre><code>let obj = {foo: 1, bar: 2, baz: 3}
  </code></pre>
  
  <p>I would like to delete a specific property by calling a method that takes as parameter the name of the property to delete</p>
  
  <pre><code>removeProperty(obj, propertyName) {
    let { propertyName, _, ...result } = obj
    return result
  }
  </code></pre>
  
  <p>the problem is that this method only works when we write the name of the property directly in the syntax spead, like: <code>let { bar, _, ...result } = obj</code> .But it does not work by passing it as a parameter, because the syntax spead creates it as a new variable</p>
  
  <p>how can we do that, with another solution if possible except the <code>omit</code> of lodash</p>