Skip to content
Advertisement

How to comment out a block of code that already has multiple line comments?

Is there a way to do something like this in Javascript?

/*
    code
    /* Multiple
    line
    comment */
    more code
*/

When I test, I often need to comment out large chunks of code that already have multiline comments.

Advertisement

Answer

I think your IDE have find and replace option.

Add /* at starting and */ at ending

Within the code block

Replace */ with *//*

then to if you want to remove the comments you made :

Remove /* at starting, Remove */ at ending

Within the code block

Replace *//* with */

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement