Strings

Replace Repeated Text

Replace Repeated Text

When the same sensitive word can appear more than once, replacing only the first match is not enough.

Your task: Write redactWord. It should return a copy of the message where every occurrence of the target word is replaced with [redacted].

Free with a JS Exercises account

Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.

By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.

Replace Repeated Text

When the same sensitive word can appear more than once, replacing only the first match is not enough.

Your task: Write redactWord. It should return a copy of the message where every occurrence of the target word is replaced with [redacted].

Free with a JS Exercises account

Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.

By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.

Console

Run code to see output.