title: Is there a way to make new key value paire inside of object, based on two values that are already inside of an object? - JavaScript
body: <p>I've got scraper who is scraping web page for data. Object keys are: id, price, descr, link, sqm, which are made out of an arrays who are populated by scraper, and all works fine.</p>
  <p>Object is created like this:</p>
  <pre><code>const object = ids.map((element, index) =&gt; ({
          id: element,
          price: prices[index],
          descr: descs[index],
          link: links[index],
          sqm: sqft[index],
        }));
  </code></pre>
  <p>now <code>console.log(object)</code> looks like:</p>
  <pre><code>[ { id: '1',
      price: '100.000 €',
      descr: 'apartment no1',
      link:
       'link to page',
      sqm: '45' },
    { id: '2',
      price: '120.000 €',
      descr: 'apartmen no2',
      link:
       'link to page',
      sqm: '42' },
    {
        ...
              },
  }]
  
  </code></pre>
  <p>Now what I want to do is to add new key to the object eg. priceperm2 and take <code>price</code> and  <code>sqm</code> from object, devide those two and put it as value of priceperm2. Eg. <code>console.log</code> to now be:</p>
  <pre><code>[ { id: '1',
      price: '100.000 €',
      descr: 'apartment no1',
      link:
       'link to page',
      sqm: '45',
      priceperm2: '2222 €'},
  
    { id: '2',
      price: '120.000 €',
      descr: 'apartmen no2',
      link:
       'link to page',
      sqm: '42',
      priceperm2: '2857 €' },
  
    {
        ...
              },
  }]
  
  </code></pre>
  <p>So it would be: <code>priceperm2</code> = <code>price/sqm</code> I would also to keep '€' from price. Is there some way of doing it? I've had no idea how to even start or if is it even possible. Maybe I need some kind of a loop to extract these two values, devide them and put it as new key:value pair?</p>
  <p>Thanks!</p>