The solution given in the Community Input removes all the whitespace from the string. That isn't trimming exactly. The correct way to do it should be...
letstr=" Samantha Ming "lettrimmedStr=str.replace(/^\s+ | \s+$/g,'')console.log(trimmedStr)// "Samantha Ming"
The solution given in the Community Input removes all the whitespace from the string. That isn't trimming exactly. The correct way to do it should be...
OH good call! let me add your point to the code notes! Thanks for info π