By John Paul Mueller

JavaScript provides access to three kinds of dialog boxes: alert(), confirm(), and prompt(). You can do multiple things with pop-ups. For example, you can make information appear on multiple lines in these dialog boxes. You can also move beyond these three basic dialog boxes by creating dialog boxes of your own.

How to control line breaks in JavaScript

Sometimes you need to divide content on multiple lines. To perform this task, you add an escape character to the string. An escape character is a special signal to JavaScript to perform some special processing on a string. It’s actually two characters, the backslash () followed by another character. Here’s a list of the escape characters that JavaScript understands:

  • : single quote

  • : double quote