Skip to content
Advertisement

New line in JavaScript alert box

How do you put in a new line into a JavaScript alert box?

Advertisement

Answer

n will put a new line in – n being a control code for new line.

alert("Line 1nLine 2");
Advertisement