title: Use value from axios function in another function
body: <p>I have this async function to get an API access token:</p>
  <pre><code>const getAccessToken = async () =&gt; {
      try {
          const body = new URLSearchParams({
              grant_type: 'client_credentials',
              scope: 'manage:all'
          }).toString();
  
          const config = {
              headers: {
                  Content_Type: 'application/x-www-form-urlencoded'
              },
              auth: {
                  username: clientId,
                  password: clientSecret
              }
          };
  
          const { data: res } = await axios.post(
              `${baseUrl}/oauth2/token`,
              body,
              config
          );
  
          return res;
      } catch (err) {
          console.log(err);
      }
  };
  </code></pre>
  <p>It return a promise which I use in the following function to log the access token to the console:</p>
  <pre><code>getAccessToken().then(res =&gt; {
      console.log(res.access_token);
  });
  </code></pre>
  <p>It logs the token as a string.</p>
  <p>Now I want to use this string value in another function in my code. Do I just call the function where I need the value like above and replace the <code>console.log</code> with <code>return</code>?</p>
  <p>How do I use this string value in other parts of my code?</p>