I have a text.txt file and I want to save its content in a variable. My problem is that I can log the text but I can't store it in a var
let fileText;
fetch("./text.txt")
.then(response => response.text())
.then(text => fileText = text);
console.log(fileText); // undefined