A2oz

What is the shortcut key for comment in JavaScript?

Published in Programming 1 min read

There is no single shortcut key for commenting in JavaScript. The shortcut depends on the code editor or IDE you are using.

Here are some common shortcuts:

  • Visual Studio Code:

    • Single-line comment: Ctrl + / (Windows/Linux) or Cmd + / (macOS)
    • Multi-line comment: Ctrl + Shift + / (Windows/Linux) or Cmd + Shift + / (macOS)
  • Sublime Text:

    • Single-line comment: Ctrl + / (Windows/Linux) or Cmd + / (macOS)
    • Multi-line comment: Ctrl + Shift + / (Windows/Linux) or Cmd + Shift + / (macOS)
  • Atom:

    • Single-line comment: Ctrl + / (Windows/Linux) or Cmd + / (macOS)
    • Multi-line comment: Ctrl + Shift + / (Windows/Linux) or Cmd + Shift + / (macOS)
  • Notepad++:

    • Single-line comment: Ctrl + / (Windows/Linux) or Cmd + / (macOS)
    • Multi-line comment: No specific shortcut for multi-line comments, you can use the block selection feature and then comment the selected code.

These shortcuts are commonly used in many editors, but it's always good to check the specific settings and shortcuts of your editor.

Related Articles