Javascript: Added hint to Match Whitespace (#19242)
* Javascript: Added hint to Match Whitespace Added hint to Match (https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/match-whitespace and https://guide.freecodecamp.org/certifications/javascript-algorithms-and-data-structures/regular-expressions/match-whitespace/) * Update index.mdpull/19438/head
parent
e73c360476
commit
da14642ea1
|
@ -1,10 +1,17 @@
|
|||
---
|
||||
title: Match Whitespace
|
||||
---
|
||||
title: Match Whitespace
|
||||
---
|
||||
|
||||
## Match Whitespace
|
||||
|
||||
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/javascript-algorithms-and-data-structures/regular-expressions/match-whitespace/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
|
||||
### Problem:
|
||||
|
||||
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
|
||||
We need to change the regex ```countWhiteSpace``` to look for multiple whitespace characters in a string.
|
||||
|
||||
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
|
||||
### Solution:
|
||||
|
||||
```js
|
||||
let sample = "Whitespace is important in separating words";
|
||||
let countWhiteSpace = /\s/g; // Change this line
|
||||
let result = sample.match(countWhiteSpace);
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue