Reputation: 4939
I am have been reading material on JavaScript and there are two ways of accessing the title
of the page:
window.title
propertydocument.title
propertyBut when applying, the second only works. I am unable to understand why there are two titles and why both of them don't work.
Upvotes: 6
Views: 3744
Reputation: 772
window.document.title
is correct.
window.title
is incorrect, because the window
object doesn't have a title
property (all the properties of window are down the left side, you'll see title
isn't there).
Upvotes: 10