title: javascript fetch promise and its return value
body: <pre><code>'use strict';
  const url = `https://www.exapmle.com/mediainfo?`
  
  function getMediaInfo(videoid) {
      fetch(url + videoid)
          .then(response =&gt; {
              if (response.ok === true) {
                  return response.text()
              } else {
                  throw new error(&quot;HTTP status code&quot; + response.status);
              }
          })
          .then(text =&gt; {
              const parser = new DOMParser();
              const doc = parser.parseFromString(text, &quot;text/xml&quot;);
              console.log(doc) //I want to make 'doc' as getMediaInfo()'s return value
          })
          .catch(error =&gt; {
              console.error(error)
          });
  
  }
  </code></pre>
  <br>
  I want to make value 'doc' as getMediaInfo()'s return value.<br>
  But I don't know how to do it. Any help?<br>