String.prototype.trimbeginner' hello '.trim() // β 'hello'
'
text '.trim() // β 'text'
'no spaces'.trim() // β 'no spaces'Use trim() to remove all leading and trailing whitespace characters from a string.
.trim() also removes spaces at the end of a string.
Challenge: Implement cleanTrailing(str) that removes trailing whitespace.
cleanTrailing('hello ') // β 'hello'