JavaScript JavaScript Basics (Retired) Storing and Tracking Information with Variables The Variable Challenge

Aakash Srivastav
Aakash Srivastav
Full Stack JavaScript Techdegree Student 11,616 Points

alert and document.write()

Cant we use expressions like, alert("Hello World!"); document.write("Hello World!"); at the same time?

1 Answer

Steven Parker
Steven Parker
203,238 Points

Sure, you can do both of those.

Those do two different things, one writes to the document (the "page"), and the other pops up a dialog box.

Just be aware than until you dismiss the dialog box, the program won't finish and the page won't actually be rendered. So no matter which order you do them, the pop-up will be seen first.