JS: Whitespace Characters

By Xah Lee. Date: .

This page shows what's considered “whitespace” from JavaScript spec.

Technically, there are 3 kindas of whitespaces by js spec:

  1. Unicode Format-Control Characters
  2. White Space
  3. Line Terminators

Unicode Format-Control Characters

Unicode has format control character such as LEFT-TO-RIGHT MARK or RIGHT-TO-LEFT MARK, and lots more.

Table 31 — Format-Control Codepoint Usage
CodepointNameAbbreviationUsage
U+200CZERO WIDTH NON-JOINER<ZWNJ>IdentifierPart
U+200DZERO WIDTH JOINER<ZWJ>IdentifierPart
U+FEFFZERO WIDTH NO-BREAK SPACE<ZWNBSP>WhiteSpace

ECMAScript 2015 §ECMAScript Language: Lexical Grammar#sec-unicode-format-control-characters

White Space

Table 32 — White Space Codepoints
CodepointNameAbbreviation
U+0009CHARACTER TABULATION<TAB>
U+000BLINE TABULATION<VT>
U+000CFORM FEED (FF)<FF>
U+0020SPACE<SP>
U+00A0NO-BREAK SPACE<NBSP>
U+FEFFZERO WIDTH NO-BREAK SPACE<ZWNBSP>
Other category “Zs”Any other Unicode “Separator, space” codepoint<USP>

ECMAScript 2015 §ECMAScript Language: Lexical Grammar#sec-white-space

Line Terminators

Table 33 — Line Terminator Codepoints
CodepointUnicode NameAbbreviation
U+000ALINE FEED (LF)<LF>
U+000DCARRIAGE RETURN (CR)<CR>
U+2028LINE SEPARATOR<LS>
U+2029PARAGRAPH SEPARATOR<PS>

ECMAScript 2015 §ECMAScript Language: Lexical Grammar#sec-line-terminators

JS String

  1. String Overview
  2. Template String
  3. Char, Code Unit, Codepoint
  4. String Escape Sequence
  5. Unicode Escape Sequence

JS RegExp

  1. RegExp Tutorial
  2. RegExp Syntax
  3. Regex Find/Replace

JS Object Reference

  1. Global
  2. Object
  3. Array
  4. Function
  5. String
  6. RegExp
  7. Date
  8. Set
  9. Map
  10. JSON
  11. Math
  12. Reflect
  13. Number
  14. Boolean
  15. Symbol
Like it? Help me by telling your friends. Or, Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.

Web Dev Tutorials