title: Is there a way to save [[Promise Result]] as a variable?
body: <p>I am trying to access [[Promise Results]] and save it as a variable. The end goal I just want the result from the .then statement and use it in other function. If there is another better way to do it please let me, I'm new to JavaScript, so it would be awesome if you could explain it to me than just dump code. Thanks is advance
  Here is the fetch request</p>
  <pre><code>function currentloginid() {
      return fetch('http://localhost/gaq/api/api.php?action=userid', {
         method: 'GET',
      })
      .then(function(response) {
          return response.json();
      })
      .then(function(data) {
          var userid = JSON.parse(data);
          console.log(userid);
          return userid;
      })
  }
  </code></pre>
  <p>The code below is when I console log the function in another function</p>
  <pre><code>Promise {&lt;pending&gt;}
  __proto__: Promise
  [[PromiseState]]: &quot;fulfilled&quot;
  [[PromiseResult]]: 1
  </code></pre>