Put HTTP get request response into variable

How do I put HTTP get request response into a variable?
I am using basic javascript XMLHttpRequest methods however I can seem to make the code return the response so that ui.vision can store it into a global variable.
Could someone please suggest some code snippet?

how can I use this code

url = ‘https://habr.com
const response = await fetch(url)
const result = await response.text()
console.log(result)

?
I am seeing this kind of error

Error in executeScript_Sandbox code: await is only valid in async functions and the top level bodies of modules