I am looking online how to upload a folder of images and display them using JavaScript, and I am seeing this code repeatedly:
var inps = document.querySelectorAll('input');
[].forEach.call(inps, function(inp) {
inp.onchange = function(e) {
console.log(this.files);
};
});
Firstly, it doesn't work on my Google Chrome (it is not logging anything), and more importantly, what is this method of doing
[].forEach.call
What does this mean? (to use [] before forEach)?