开发者

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

I want to know what is vertical tab, f开发者_如何转开发orm feeds and backspace character and how to use them in JavaScript? Or is there any chance I have to(should) use them?


  • 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:

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜