js special characters in string code example
Example 1: js escape characters
JS Escape Characters
\' — Single quote
\" — Double quote
\\ — Backslash
\b — Backspace
\f — Form feed
\n — New line
\r — Carriage return
\t — Horizontal tabulator
WebsiteSetup.org - Beginner’s Javascript Cheat Sheet 7
\v — Vertical tabulator
Example 2: escape in javascript
escape sequences in javascript
\' single quote
\" doucle quote
\\ backslash
\n newline
\r carriage return
\t tab
\b backspace
\f form feed
Example 3: add a slash to string in javascript
var str = 'USDYEN'
var newStr = str.slice(0,3) + ' / ' + str.slice(3)
console.log(newStr)