jslint: remove whitespaces using simple regex

Replacing obsolete for loop with a simple regex to remove whitespaces, if a line contains only whitespace.