For example, if we want to know if the currently loaded document is written using HTML 5 or 4, etc. we could use this property.
The return value of this property is an object called DocumentType object that has a property called “name” by which we can get the name of the doctype.
document doctype Property Syntax:
document doctype Property Input Value
The doctype property is read-only.
document doctype Property Return Value
The return value of this property is a reference to an object called DocumentType that contains a property called “name”. Using this `name` property, we can get the name of the doctype.
Note: if the doctype is not defined for the current document, the return value of the property will be null.