I'm trying to load a text file and store lines within the text file into an array variable. I found a related issue but I want to enhance it furtheremore
<div>
Select a text file:
<input type="file" id="fileInput">
</div>
<pre id="displayFile"></pre>
<script>
var fileInput = document.getElementById('fileInput');
fileInput.addEventListener('change', function(e) {
var file = fileInput.files[0];
var reader = new FileReader();
reader.onload = function(e) {
document.getElementById('displayFile').innerText = reader.result;
myAddress.push(reader.result)
};
reader.readAsText(file);
});
</script>
and I want the lines that are read go into myAddress array
var myAddress = [];