The assign() method is used for loading a new document. It is similar to replace() method but the main difference is that replace() method removes the current URL from the history list and we can not go back or navigate backward.
Its syntax is:- location.assign(URL)
|URL||Required. The URL of a page to navigate to.|