We can send output to the browser by using the alert() method. The alert() method creates a little independent box—called a dialog box—which contains a small triangle with an exclamation point.
A user-customized message is placed after the triangle, and beneath it, an OK button. When the dialog box pops up, all execution is stopped until the user presses the OK button in the pop-up box. The exact appearance of this dialog box may differ slightly on different browsers, but its functionality is the same.
The message for the alert dialog box is a string of text (or a valid expression) enclosed in double quotes, and sent as a single argument to the alert() method. HTML tags are not rendered within the message string but you can use the escape sequences, \n and \t.
The alert() method will produce a little dialog box, independent of the current document, and all processing will be stopped until the user presses the OK button. This little box can be moved around the screen with your mouse.
Was this information useful? What other tips would you like to read about in the future? Share your comments, feedback and experiences with us by commenting below!