How to delete the key of the object based on user input? : <p>I have an object which basically consists of some of the names of cars. I just want to <strong>delete the key of that object</strong> based on user input.</p>

<p>For instance:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>let cars = {
  car1: 'BMW',
  car2: 'Lambo',
  car3: 'Mercedes'
};

const deleteCar = (car) =&gt; {
  delete cars.car;
}

deleteCar('car1');
console.log(cars);</code></pre>
</div>
</div>
</p>

<p>As you can see, it doesn't actually delete the key from the object. How can I do this?</p>
