Thursday, September 13, 2018

JavaScript - Document Object Model - Location object

The location object in JavaScript refers to the location bar in the browser. Examples:

  • console.log(location.pathname)
  • console.log(location.reload())
  • console.log(location.replace("https://www.google.com"))


Location object is very useful to know where you are and to get to another point where you want to navigate to.

Refer:
https://developer.mozilla.org/en-US/docs/Web/API/Location

Practice at:
http://jsbin.com

No comments:

Post a Comment