Must I escape forward slashes in Javascript?
In Dreamweaver the characters between a pair of forward slashes in a very simple calculation, like this:
var foo = Math.round(bar/3)+Math.floor(bar/2)开发者_JAVA技巧;
is read as a regex (at least by the syntax coloring). Will this break my code? Do I need to escape it somehow?
Dreamweaver is getting confused. That code won't be interpreted as a regex.
That seems to be a major syntax highlighting bug in Dreamweaver. A single forward slash alone should not trigger the colouring for regular expressions. Use a different editor, such as Notepad2, or gedit.
精彩评论