Tell us what’s happening:
My function does return the plain text content with all tags removed, but all the tests failed. ![]()
Your code so far
function extractContent(html) {
const removeRegex = /\<\>/gi
return `"${html.replaceAll(removeRegex, "")}"`;
}
console.log(extractContent('<p>hello world</p>')) //returns "hello world"
console.log(extractContent('<p>hello <span>world</span></p>')) //returns "hello world"
console.log(extractContent('<a href="example.com">Click me</a>')) //returns "Click me"
console.log(extractContent('<p><button onClick="learnToCode()">Learn</button> to <code>code<code> <br/>for <strong>free</strong> <br/>on <a href="https://freecodecamp.org/" target="_blank"><span class="highlight">freecodecamp</span>.org</a>')) //returns "Learn to code for free on freecodecamp.org"
console.log(extractContent('<div class="container"><h1 id="title">Welcome to <strong>My</strong> Website.</h1><p>This is a <a href="https://example.com" target="_blank">link</a> to something <em>really</em> <span class="highlight">important</span>.</p><ul><li>Item <strong>one</strong></li><li>Item <em>two</em></li><li>Item three</li></ul><img src="pic.jpg" alt="A picture"/><p class="footer">Contact us at <a href="mailto:hello@example.com">hello@example.com</a> for <span>more <strong>info</strong></span>.</p></div>')) //returns "Welcome to My Website.This is a link to something really important.Item oneItem twoItem threeContact us at hello@example.com for more info."
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36 Edg/149.0.0.0
Challenge Information:
Daily Coding Challenge - HTML Content Extractor
https://www.freecodecamp.org/learn/daily-coding-challenge/2026-06-12