title: How to create key value pair using two arrays in JavaScript?
body: <p>I have two arrays, <code>keys</code> and <code>commonkeys</code>. </p>
  
  <p>I want to create a key-value pair using these two arrays and the output should be like <code>langKeys</code>.</p>
  
  <p>How to do that?</p>
  
  <p>This is array one:</p>
  
  <pre><code>var keys=['en_US','es_ES', 'pt_PT','fr_FR','de_DE','ja_JP','it_IT']
  </code></pre>
  
  <p>This is array two:</p>
  
  <pre><code>var commonKeys=['en-*','es-*', 'pt-*','fr-*','de-*','ja-*','it-*', '*']
  </code></pre>
  
  <p>This is the output I need:</p>
  
  <pre><code>var langKeys = {
      'en-*': 'en_US',
      'es-*': 'es_ES',
      'pt-*': 'pt_PT',
      'fr-*': 'fr_FR',
      'de-*': 'de_DE',
      'ja-*': 'ja_JP',
      'it-*': 'it_IT',
      '*': 'en_US'
  };
  </code></pre>