You can also use the replace solution above to add a trim function to the JavaScript String.prototype:
By Badie96 at Apr 22 2021
javascript trim
By Kristin Johnson at Mar 08 2021
js trim()
By Testy Toucan at Feb 04 2021
JavaScript chop/slice/trim off last character in string
By Lucy Durgan at Dec 29 2020
trim text and add ... js
By Melody Powlowski at Nov 24 2020
trim first character in javascript
By Viola Emard at Oct 06 2020
javascript split and trim
By Hungry Hamerkop at Aug 19 2020
javascript trim spaces
By Glenn Jaskolski at Feb 06 2020
javascript right trim
By Kathryn Baumbach at Jan 16 2020
By Eric Fay at Jun 26 2019