Incorrect object properties in the console window
When logging some object types in the console, you can get misleading results. Consider the following code, for getting a file from a file upload dialog shown to the user:
input.addEventListener('change', (e) => {
console.log("Event object e: %o", e);
console.log("Event target e.target: %o", e.target);
console.log("File e.target.files[0]: %o", e.target.files[0]);
});
Suppose we now upload a file, triggering this input's event listener. The result of the first logging statement, logging the whole event object, looks like this:
You might therefore think that e.target is null, and that trying to access e.target.files[0] will give an error. However...