I’ve found solution for Regular Expressions - Remove Whitespace from Start and End Challenge which I think is a little simpler than what is present as Solution in Guide Page.
I’ve checked it with multiple words, devided by multiple whitespaces and I think it works as it should. Am i right or am I missing something? Does .replace() has any kind of adventage in that case?
FreeCodeCamp proposed solution:
let hello = " Hello, World! "; let wsRegex = /^\s+|\s+$/g; // Change this line let result = hello.replace(wsRegex, ""); // Change this line
let hello = " Hello, World! "; let wsRegex = /\S+.*\S+/; // Change this line let result = hello.match(wsRegex); // Change this line
Thank you in advance for you comments!