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.
str.trim() removes whitespace from both the start and end of a string.
Challenge: Implement trimStr(str) that trims whitespace from both ends.
trimStr(' hello') // β 'hello'