title: How to save json returned from axios in a variable?
body: <p>I want to save the json returned from axios into a variable. Currently I can only see it when I console.log(response.data) with the following code:</p>
  <pre><code>function status() {
    const url = &quot;https://api.com&quot;;
    axios.get(url).then(function (response) {
      console.log(response.data);
    });
  }
  status(); // console.logs object successfully
  </code></pre>
  <p>If I just set response.data to a variable instead of logging it, it stays blank ( {} ).
  I want to do something like this:</p>
  <pre><code>let data = {};
  function status() {
    const url = &quot;https://api.com&quot;;
    axios.get(url).then(function (response) {
      data = response.data;
    });
  }
  status();
  console.log(data); // {}
  // I want to manipulate and use the properties of data in subsequent code here
  </code></pre>
  <p>How may I accomplish this please? Thank you for the help.</p>