async function loadText(file) {
const response = await fetch(file);
if (!response.ok) {
myDisplayer(response.status + " " + response.statusText);
return;
}
myDisplayer(await response.text());
}
loadText("fetch.txt");
// Function to display any text
function myDisplayer(text) {
document.getElementById("demo").innerHTML = text;
} Syntax Highlighting Test
- Details
- Written by: Timothy Michel