Here we will practice Promises through the Fetch API.
Your task is to load the list of words found in data.txt, sort it and display it on the page.
Working in main.js;
- Create a function called
processData
- When the
<button>
is clicked, it should runprocessData
The processData
function should;
- Fetch the contents of the file data.txt
- Convert the fetched text data into an array, with each line of the text as a separate array item
- Sort the array alphabetically
- Display the sorted array as a
<ul>
list on the web page, with each array item as an<li>
element