Im trying to avoid the arrow function because I need to support IE11.
Working code on chrome/firefox/edge:
reader.onload = (e) => {
let name = this.files[0].name;
console.log(name);
};
Trying to convert this code into normal function syntax:
reader.onload = function(e) {
let name = this.files[0].name;
console.log(name);
};
but now this.files[0]
is undefined. In the first code block it isn't undefined. Why is this and how can I fix it?