Is there any shortcuts to comment out multiple lines of code in JavaScript? I know the shortcut for the single line is ctrl+/
Thank you, but what I was asking about is if there is a keyboard shortcut…
Select the lines you want to turn into a comment, then apply the short cut from your post.
I’ve tried that, but it doesn’t work…
This is how it turns out:
// lines
// to be
// commented
CTRL + K followed by C
So hold CTRL
, press K
, then press C
1 Like
For multiple lines in most editors, just highlight the lines and press Ctrl + /
—it works for block commenting too. If you’re using VS Code, that shortcut toggles comments whether it’s one line or many.
1 Like
A little late, and I suppose it depends on the editor. But for VS Code/fCC editor, the keyboard shortcut for toggle block comment is:
Windows: Shift + Alt + A
Mac: Shift + Option + A
1 Like