Event.tartget.files [0] parameter in picture upload

let file = event.target.files [0];
looks at the property values of this event.tartget.files [0] in the console, as shown in figure

clipboard.png
then I want to know what type this attribute value is. The first habitual thinking is the object type, and then we"ll see how it looks like a function type. Here"s the point. I use

.
console.log (Object.prototype.toString.call (file) ="[object Object]"); / / false
console.log (Object.prototype.toString.call (file) ="[object Function]"); / / false

console.log (typeof file); / / object
curious, what kind of goods is this? Partners with research share their experiences

Apr.09,2021

File

reason WEB API has nothing to do with js objects, or WEB API does not belong to js .


is an object MDN Document


print the console.log directly (Object.prototype.toString.call (file)) will know


console.log (Object.prototype.toString.call (file) ='[object File]') = > true

Menu