diff --git a/syntax/javascript.nanorc b/syntax/javascript.nanorc
index 4324450d25dfa79af6ad121e8356aaed44679ce1..15d63f12527302a577872654cdf6c864b37a80d5 100644
--- a/syntax/javascript.nanorc
+++ b/syntax/javascript.nanorc
@@ -13,7 +13,7 @@ color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\
 # Strings.
 color brightyellow "<[^= 	]*>" ""(\\.|[^"])*"" "'(\\.|[^'])*'" "`(\\.|[^`])*`"
 # Comments.
-color brightblue "//.*"
+color brightblue "(^|[[:space:]])//.*"
 color brightblue start="/\*" end="\*/"
 
 # Trailing whitespace.