I have some Javascript that is interacting with the DOM from a website.
document.location.href="https://www.example.com";
It works well from Chrome console, but I would like to run that code from the command line. How can I do it? NodeJS gives "document is not defined" error.