* fix: restructure certifications guide articles * fix: added 3 dashes line before prob expl * fix: added 3 dashes line before hints * fix: added 3 dashes line before solutions
750 B
750 B
title
title |
---|
Match Whitespace |
Match Whitespace
Problem Explanation
To finish this challenge, it's necessary to use the /s character class in your regexp pattern.
\s matches a single white space character. (including space, tab, form feed, line feed and other Unicode spaces.
For example:
/\s\w*/;
// matches " bar" in "foo bar".
important: Characters are case sensitive in regexp. \S matches a single character other than white space.
Solutions
Solution 1 (Click to Show/Hide)
let sample = "Whitespace is important in separating words";
let countWhiteSpace = /\s/g; // Change this line
let result = sample.match(countWhiteSpace);