To solve this challenge you simply have to create a regex string that matches any spaces at the beginning or at the end of the string.
Think of how you can select substrings at the beginning or end of a string.
Think of how you can select whitespace
Solution 1 (Click to Show/Hide)
let hello = " Hello, World! "; let wsRegex = /^\s+|\s+$/g; // Change this line let result = hello.replace(wsRegex, ""); // Change this line