const fetched_data = []; //replace with url you want to fetch fetch('https://url_to_fetch') .then(response => response.json()) .then(data => fetched_data = data)