title: How to get PromiseValue in XMLHttpRequest. JSON
body: <p>How to get array that is located on <strong><code>PromiseValue</code></strong> instead of getting <strong><code>Promise {&lt;pending&gt;}</code></strong>
  While I'm using <strong><code>.then(data =&gt; console.log(data))</code></strong> I'm getting array in console log. 
  However, I need to get an array to place it on the html page so I changet code to <strong><code>.then(data =&gt; data)</code></strong> and started to get <strong><code>Promise {&lt;pending&gt;}</code></strong></p>
  
  <pre><code>const baseUrl = 'http://localhost:3000';
  
  function sendRequest(method, url, data = null) {
      return new Promise((resolve, reject) =&gt; {
          const xhr = new XMLHttpRequest();
  
          xhr.open(method, url);
  
          xhr.responseType = 'json';
          xhr.setRequestHeader('Content-Type', 'application/json');
          xhr.onload = () =&gt; {
              if (xhr.status &gt;= 400) {
                  reject(xhr.response);
              } else {
                  resolve(xhr.response);
              }
          }
  
          xhr.onerror = () =&gt; {
              reject(xhr.response);
          }
  
          xhr.send(JSON.stringify(data));
      });
  }
  
  let getData = sendRequest('GET', baseUrl + '/users')
  .then(data =&gt; data)
  .catch(err =&gt; console.log(err));
  
  console.log(getData);
  </code></pre>
  
  <p>Thanks in advance.</p>