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.
trimEnd() does NOT touch the leading whitespace β only trailing whitespace is removed.
Challenge: Implement trimEndOnly(str) that removes trailing but preserves leading whitespace.
trimEndOnly(' hello ') // β ' hello'