Alert box with line-breaks:
alert("Hello\nHow are you?");
Click the button to demonstrate line-breaks in an alert box.
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <script> function myFunction() {/* www . j a v a 2 s .com*/ alert("Hello\nHow are you?"); } </script> </body> </html>