What is vertical tab, form feeds and backspace character? How to use them in JavaScript?

  • Vertical tab: \v = U+000b
    • "Position the form at the next line tab stop." (ignored on Safari.)
  • Form feed: \f = U+000c
    • "On printers, load the next page. In some terminal emulators, it clears the screen." (truncates the string on Safari.)
  • Backspace: \b = U+0008
    • "Move the cursor one position leftwards." (ignored on Safari.)

These escape sequences are defined probably because all other C-derived languages have them. Generally you won't need to use them, nor they will have useful effects on the text.


I will try to make the explanation as easy as possible with an example:

\f or FormFeed, with advance to the next line and omit the number of characters in the previous line

\r or Return Carriage will go to the start of the current line and print characters

var myString = "One Two Four\fThree\rKing";

console.log(myString);

Output: