What does JavaScript take as default?

0

Example, I have window.location.href , location.href , document.location.href

This second case, what will JavaScript default to? o Window? Default I say, I can use both the window and the document, so since I do not add anything, it gets what? Or is there a difference between the 3 commands?

    
asked by anonymous 09.10.2017 / 15:09

1 answer

2

window.location is an object that holds all information about the current location of the document (host, href, ports, protocols, etc.)

document.location is a synonym for window.location , but has been deprecated for quite some time. Do not use this.

location.href is the abbreviated form of window.location.href (if you call the global object location - window , then that is window.location.href ), and in the end this is just a string with the full url of website.

Fonts

09.10.2017 / 15:16