Trimming strings in Javascript

trim removes whitespace from both ends. trimStart removes whitespace from the start of a string. trimLeft does the same. trimEnd removes it from the end. trimRight does the same.