There are two variables with a given value.
I use alert to display values ​​with a description of them:

 alert ("описание1: " + myVariable1 + "описание2: " + myVariable2); 

How to add line breaks in this case?
/n , as far as I understand, works only inside a string .

  • one
    Well, the same flow is transmitted to the alert and it even understands line feeds. alert ("aaa" + ... + "\ n" + ...) - Mike
  • Thanks, I just thought about "\ n", but I thought maybe there is another accepted way. Thank! - Rumata

1 answer 1

Here you can also add a newline character:

 alert ("описание1: " + myVariable1 + "\nописание2: " + myVariable2); 

or

 alert ("описание1: " + myVariable1 + "\n" + "описание2: " + myVariable2); 

You just get one line inside the alert .

  • Yes, this is what you need, thank you very much! - Rumata
  • @MaximVelichkin But not for that. - Vlad from Moscow