Higher Order Functions

Chain Cleanup Steps

Chain Cleanup Steps

Chaining works best when each step has one job. A cleanup pipeline might trim values, remove blanks, and then transform the remaining values into the display format the UI expects.

The order matters because blank strings are easier to detect after trimming. Once the unwanted values are gone, the remaining tags can be transformed without special cases.

Your task: Complete cleanTags so it returns lowercase, trimmed tags and removes blank entries. Preserve the order of the nonblank tags.

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.

Chain Cleanup Steps

Chaining works best when each step has one job. A cleanup pipeline might trim values, remove blanks, and then transform the remaining values into the display format the UI expects.

The order matters because blank strings are easier to detect after trimming. Once the unwanted values are gone, the remaining tags can be transformed without special cases.

Your task: Complete cleanTags so it returns lowercase, trimmed tags and removes blank entries. Preserve the order of the nonblank tags.

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.