--- id: 6a0dcd03ee4e68698080ef6a title: "Challenge 306: HTML Content Extractor" challengeType: 28 dashedName: challenge-306 --- # --description-- Given a string of HTML, return the plain text content with all tags removed. # --hints-- `extractContent('
hello world
')` should return `"hello world"`. ```js assert.equal(extractContent('hello world
'), "hello world"); ``` `extractContent('hello world
')` should return `"hello world"`. ```js assert.equal(extractContent('hello world
'), "hello world"); ``` `extractContent('Click me')` should return `"Click me"`. ```js assert.equal(extractContent('Click me'), "Click me"); ``` `extractContent(' to to code
for free
on freecodecamp.org')` should return `"Learn to code for free on freecodecamp.org"`.
```js
assert.equal(extractContent('code
for free
on freecodecamp.org'), "Learn to code for free on freecodecamp.org");
```
`extractContent('')` should return `"Welcome to My Website.This is a link to something really important.Item oneItem twoItem threeContact us at hello@example.com for more info."`.
```js
assert.equal(extractContent(''), "Welcome to My Website.This is a link to something really important.Item oneItem twoItem threeContact us at hello@example.com for more info.");
```
# --seed--
## --seed-contents--
```js
function extractContent(html) {
return html;
}
```
# --solutions--
```js
function extractContent(html) {
return html.replace(/<[^>]*>/g, '').trim();
}
```