In the simple alert method, we can add line breaks easily.
You may also read,
The below line will create an alert message with a line break.
alert('This is first line\nThis is second line');
The ‘\n’ is used to create a line break.
Here is an easy example where if you click on the button you will get a message with a line break.