What Is Considered a Whitespace Character in JavaScript?

Whitespace refers to a set of characters that can be used to add horizontal or vertical space between characters. These characters and their usage vary among different languages. In JavaScript, a whitespace character can be any of the following:

Character Unicode Decimal Regex
Space U+0020 32
Carriage Return U+000D 13 \r
Form Feed U+000C 12 \f
Vertical Tab U+000B 11 \v
New Line, Line Feed or End-of-Line U+000A 10 \n
Horizontal Tab U+0009 9 \t

This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.