Welcome to your JavaScript problem sets! These exercises are designed to help you practice real-world coding skills that you'll use as a software developer. Each problem focuses on a specific skill, like validating user input or handling API data, and is solvable in about 20 minutes. You'll get a clear explanation, starter code, and test cases to check your work. Let's dive in and start building!
When users fill out forms on a website (like signing up for an account), their input can be messy—extra spaces, weird characters, or even malicious code like <script> tags. As a developer, you need to clean and validate this input to keep your app safe and functional.
Write a function sanitizeUserInput that cleans up a user input string for a registration form. Your function should: