👋 Hello! I'm Alphonsio the robot. Ask me a question, I'll try to answer.

# 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 string, the expected output is:

A string
with two carriage
return

More