Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

124
Views
Is document.all an object or a function?

The title is the question. (Do not mention functions being objects that are callable; it is not the conventional categorization.)

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

.all is a property of the document (or prototype), and that property is a getter that returns a function. In other words, referencing the .all property invokes the getter (which is one function), and then the getter gives you another function. This behavior is specified here (but is way obsolete, and not something you should ever see nowadays).

For example, in Chrome, you can see that the property is a getter in the following:

console.log(
  Object.getOwnPropertyDescriptor(Document.prototype, 'all')
);

and that the value returned is callable by calling it:

document.all();

The value returned by the getter is an HTMLAllCollection.

It doesn't inherit from Function.prototype, so it's not a normal function - it's an exotic object - but it does have a [[Call]] internal method and so is callable and can be called a function. (and functions are also objects, of course, as you know)

about 4 years ago · Juan Pablo Isaza Report

0

I would say document.all is an function that returns an object/collection.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!