Be aware that alerts interrupt the flow of execution and aren't really a good way to debug. Rather, be sure that you have the Dev Tools open and use console.log() and its related console methods to print to the JavaScript console without blocking.

You can also set breakpoints in the debugger and actually stop execution at a certain point to look around at variable values.

2. This will write Hello to the DOM element so you will see on screen as HTML page gets rendered

Also, be aware that document.write is a sledgehammer that's only evaluated while the page is initially begin constructed. It's OK for a novice to play with, but when you really want to add things to the DOM at run time, you'll need to learn the DOM API, or use a tool like jQuery (or others).

Read more about the Chrome Dev Tools here. Every major browser has an equivalent tool.