title: How to create a new object from my existent object in Javascript
body: <p>How do I create a new object from my other object please? So I have this code:</p>
  
  <pre><code>var test = {
      p1: [
          'factorial',
          '11'
      ],
      p3: 'temp1',
      x1: 'factorial'
  }; 
  </code></pre>
  
  <p>and I want to get this:</p>
  
  <pre><code>Newobj = {
      factorial: [
          'p1',
          'x1'
      ],
      11: 'p1',
      temp1: 'p3'
  } 
  </code></pre>
  
  <p>To explain more: the values from the first object will be the keys in the second, but as you see there is an array, I need to go through all the values. Plus, I don't want to get a repeated one. For example, factorial exists in two keys : p1 and x1 so factorial needs to be written only once but with an array containing from where we got it.</p>
  
  <p>Thank you!!</p>