Skip to content

Commit bbd3725

Browse files
committed
Use 'unless' instead of 'if !'
1 parent 3ad16a8 commit bbd3725

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

chapters/strings/trimming-whitespace-from-a-string.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ To trim only trailing whitespace, use the following:
3737
Opera, Firefox and Chrome all have a native string prototype `trim` method, and the other browsers could add one as well. For this particular method, I would use the built-in method where possible, otherwise create a polyfill:
3838

3939
{% highlight coffeescript %}
40-
if !String::trim? then String::trim = -> @replace /^\s+|\s+$/g, ""
40+
unless String::trim then String::trim = -> @replace /^\s+|\s+$/g, ""
4141

4242
" padded string ".trim
4343
# => 'padded string'

0 commit comments

Comments
 (0)