Add line breaks and tabs
Below is a sample with line breaks and tabs in the string.
//Line breaks let str = 'Hello\nWorld!'; console.log(str); //result //"Hello //World!" //Tabs let str = 'Hello\tWorld!'; console.log(str); //result "Hello World!"
Special characters are entered in the form of “\ + characters” in the parts that are replaced with line breaks and tabs at the time of output.
Escape sequences are special strings that allow characters that cannot be represented by keyboard input to be represented in the form of “\ + characters”.