Extracting an object from fetch

I have this regular FETCH code that returns an object called json I want to be able to use the object in another function so I was trying to turn it into a constant but it won’t let me do it

import {fetch} from 'wix-fetch';

// ...

fetch("https://exchangeratesapi.io/api/latest", {method: "get"})
  .then( (httpResponse) => {
 if (httpResponse.ok) {
 return httpResponse.json();
    } else {
 return Promise.reject("Fetch did not succeed");
    }
  } )
  .then(json => 

// I AM ABLE TO USE JSON HERE BUT IT WON'T LET ME DECLARE A CONST
             
   console.log(json)
             
  )
  .catch(err => console.log(err));
  

export function Button_click(event, $w) {

 // I want to use the oject here
 
}

declare a global variable like let jsonContent; then at the console.log(json) do jsonContent = json; then you will get the content from the global variable. Cheap trick.

Other solution would be to make the fetch a function that returns the json to the other outside function.