In JavaScript, how to insert a carriage return in a string?
In JavaScript, you can use the special character \n to insert a carriage return in a string:
const my_string = 'A string \n with two carriage \n return';
If you console.log(my_string) the previous string, the expected output is:
A string
with two carriage
return
In JavaScript, you can use the special character \n to insert a carriage return in a string:
const my_string = 'A string \n with two carriage \n return';
If you console.log(my_string) the previous string, the expected output is:
A string
with two carriage
return
In JavaScript, you can use the special character \n to insert a carriage return in a string:
const my_string = 'A string \n with two carriage \n return';
If you console.log(my_string) the string, the expected output is:
A string
with two carriage
return
| # | ID | Query | URL | Count |
|---|---|---|---|---|
| 0 | 13112 | en | https://en.ans.wiki/131/in-javascript-how-to-insert-a-carriage-return-in-a-string | 5 |