Vladimir Kornea Vladimir Kornea - 2 months ago 12x
Javascript Question

Why isn't the FileList object an array?

Documentation: https://developer.mozilla.org/en-US/docs/Web/API/FileList

Why is

an object rather than an array? The only property it has is
and the only method it has is
, which is redundant (
fileList[0] === fileList.item(0)


Well, there could be several reasons. For one, if it were an array, you could modify it. You can't modify a FileList instance. Secondly but related, it could be (probably is) a view onto a browser data structure, so a minimal set of capabilities makes it easier for implementations to provide it.