Trim

Last update in 2/2020

To remove whitespace on start or end of string you can use built in trim method.

'      hello world  '.trim() // 'hello world'

Or if you want to trim only start or end you can use these methods.

'      hello world  '.trimStart() // 'hello world  '
' hello world '.trimEnd() // ' hello world'