title: Replace object1 values with values of object2
body: <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>var object1 = {
    lol_gif: [22390036, 15154597, 13491369],
    silly_gif: [19048808, 19048861]
  }
  
  var ids = Object.values(object1).toString();//will return 22390036,15154597,13491369,19048808,19048861
  httpGetAsync('https://g.tenor.com/v1/gifs?ids=' + ids + '&amp;key=LIVDSRZULELA&amp;media_filter=tinygif');
  
  
  function httpGetAsync(theUrl) {
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.onreadystatechange = function() {
      if (xmlHttp.readyState == 4 &amp;&amp; xmlHttp.status == 200) {
        var response = JSON.parse(xmlHttp.responseText);
        var gifs = response.results;
        var object2 = {};
        for (var g in gifs) {
          var id = gifs[g].id;
          object2[id] = gifs[g].media[0].tinygif.url;
        }
        console.log(object2);
        //will return an object with the ID as the keys and gif url as the values
      }
    }
    xmlHttp.open("GET", theUrl, true);
    xmlHttp.send();
    return;
  }</code></pre>
  </div>
  </div>
  
  I am trying to categorize each gif by replacing object1 values with data from tenor json but failed many times. thanks for your help!</p>
  <p>desired output:</p>
  <pre><code>var object1 = {
    lol_gif: [&quot;https://media.tenor.com/images/4ad4bc701f2744ddc5220f6d3688e899/tenor.gif&quot;,
              &quot;https://media.tenor.com/images/c9b8564d6acbbba994b5413479d0fc2b/tenor.gif&quot;,
              &quot;https://media.tenor.com/images/7c27bea2fb5ea0f7600af7e9ad8d0c4a/tenor.gif&quot;],
    silly_gif: [&quot;https://media.tenor.com/images/59669ec95913ef1df85fee2cda08aece/tenor.gif&quot;,
                &quot;https://media.tenor.com/images/59669ec95913ef1df85fee2cda08aece/tenor.gif&quot;]
  }
  </code></pre>