Let us start with some simple uses.
assignWe can use assign method to add a new URL to our browser so we can send to a new page.
You can use Back button of your browser to return to this page.
Source code is here
<input type=button value='JavaScirpt Home' onClick=window.location.assign('site_map.php');>Demo button is here
Use Back button to return to this page.
replaceReplace method will also take you to a new URL but you can't use Back button of your browser to return to this page. Unlike assign method replace method delete history or previous URL from browser.
Source code is here.
<input type=button value='New Page' onClick=window.location.replace('location-demo.php');>Demo button is here.
Use the link on the New Page to return to this page as you can't use Back button.