String.prototype.trimEndbeginner' hello '.trimEnd() // β ' hello'
'text '.trimEnd() // β 'text'
'hi'.trimEnd() // β 'hi'Use trimEnd() to remove only trailing whitespace from the end of a string, leaving leading whitespace intact.
str.trimEnd() removes whitespace from the end (right side) of a string only.
Challenge: Implement trimRight(str) that removes trailing whitespace.
trimRight('hello ') // β 'hello'