简体   繁体   中英

Can double slashes on comments produce unexpected errors?

I need to know if double // slashes on the URL comment could produce errors:

function jsFunction(){
    //http://google.com
    var str="...";
}

Other than syntax-highlighting-related errors

// are single line comments, anything after it on the same line will be commented out, even more / characters.

/* is used to begin a multi-line comment. The next */ will end the multi-line comment. This could be an issue if you try comment out a regular expression:

/**
var foo = /.*/g
 */

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM