title: How to create multiple objects from array's value in javascript?
body: <p>I have an array like this :</p>
  <pre><code>const data = [{
  color:&quot;red&quot;,
  to:1,
  from:2,
  opacity:12
  
  }]
  </code></pre>
  <p>I want something like this :</p>
  <pre><code>const converted = [{from:2},{to:1},{opacity:12}]
  </code></pre>
  <p>what i am trying is</p>
  <pre><code>const mappeData = data.map(({from,to,opacity})=&gt;({from:from},{to:to},{opacity:opacity}))
  </code></pre>
  <p>but this is not working</p>