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 Code Point Usage
Code PointNameAbbreviationUsage
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 Code Points
Code PointNameAbbreviation
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” code point<USP>

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

Line Terminators

Table 33 — Line Terminator Code Points
Code PointUnicode 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, Code Point
  4. String Escape Sequence
  5. Unicode Escape Sequence
  6. String to Number
  7. Encode URL, Escape String
  8. Format Number
  9. Source Code Encoding
  10. Allowed Characters in Identifier
  11. String Object
  12. String.prototype

RegExp Topic

  1. JS: RegExp Tutorial
  2. JS: RegExp Syntax
  3. JS: Regex Find/Replace
  4. JS: RegExp Object
  5. JS: RegExp Constructor
  6. JS: RegExp.prototype

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
Liket it? Put $5 at patreon.

Or, Buy JavaScript in Depth

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

Web Dev Tutorials

  1. HTML
  2. Visual CSS
  3. JS in Depth
  4. JS Reference
  5. DOM
  6. SVG
  7. Web Dev Blog