The Data Scrub

Easy+20 XP

Mission Briefing

The data sensors keep picking up strange, empty static at the beginning and end of incoming transmissions. You must scrub this dirty data before it reaches the main console.

The Concept: String Cleaning

The .trim() method removes whitespace (spaces, tabs, newlines) from both the beginning and the end of a string. It leaves any spaces in the middle completely untouched. Example: " hello world ".trim(); // Returns "hello world"

The Objective

Your function receives a string input that might be wrapped in annoying whitespace.

  1. Clean the string by stripping away the leading and trailing spaces using .trim().
  2. Return the sparkling clean string.

01EXAMPLE 1

Inputinput = " CodeMagicX "
Output"CodeMagicX"

Constraints

  • Remove lead/trail spaces only.
FundamentalsStrings
JavaScript
Loading...
3 Hidden

Input Arguments

input" test "

Expected Output

test

Click RUN to test your solution