In this code :
document.getElementById()
Is document an object that has properties and methods?
If yes, is getElementById() a method on this object?
If no, What are document and getElementById considered?
In this code :
document.getElementById()
Is document an object that has properties and methods?
If yes, is getElementById() a method on this object?
If no, What are document and getElementById considered?
Yes, document is an object.
typeof document; // "object"
And getElementById is a property on that object.
getElementById is an method of the Document prototype.!!document.getElementById ==> true'getElementById' in document === true The function is still accessible from document, despite not being the direct owner.document inherits from Document through [currentDocumentType]Document proto. So depending on what are the expectations of OP, it may do an difference.