I am trying to make a JavaScript code to return data from a API request to the user when they click a button, this is my code:
function myFunction() {
response = fetch(URL, { mode:'no-cors',});
alert(response.text())
}
but that returns an error: response.text is not a function
how can I turn response = fetch(URL, { mode:'no-cors',});
into text?