javascript – How is windows.location or windows.location.assign correct?

Question:

I want to use javascript to go to a new page. How is it correct?

windows.location = 'new_page';

or

windows.location.assign('new_page');

Or can you use this and that?

Answer:

It would be more correct to use:

window.location.href = 'new_page';
Scroll to Top