I have an HTML file with the following code:
<input type="File" id="myFile" name="filename" onchange="loadFile(this.files[0])">
And a javascript file with the following code:
const fileInput = document.getElementById('myFile');
fileInput.onchange = () => {
var allFolders = fileInput.files[0].text();
console.log(allFolders);
}
When I open my console log, I receive the message:
Promise { <state>: "pending" }
<state>: "fulfilled"
<value>: "{'1' : { '2' : { '3' : { 'a': {}, 'b' : {}, 'c' : {}}}}};"
I want to console log ONLY the value so that my console log returns
"{'1' : { '2' : { '3' : { 'a': {}, 'b' : {}, 'c' : {}}}}};"
but I am not sure how to retrieve it, given the structure of the code I have written. Does anyone know, using the simple code I already have functioning, what to add to make console.log(allFolders) return the value of the promise?