Trailing whitespaces bring no information, they may generate noise when comparing different versions of the same file, and they can create bugs when they appear after a \ marking a line continuation. They should be systematically removed.
An automated code formatter allows to completely avoid this family of issues and should be used wherever possible.
// The following string will error if there is a whitespace after '\' var str = "Hello \ World";