EventTarget.addEventListener
expects a function as second argument.
You pass readFile()
as the second argument. readFile()
is not a function. It's the result of calling the function readFile
. When you call that function (to pass its result to EventTarget.addEventListener
), this.files[0]
is undefined, because this
still references the global object, which does not have a files
property.
Pass readFile
as second argument to EventTarget.addEventListener
, instead of readFile()
.