Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Foundations Variables Scope

Can anyone tell me the "commenting out" shortcut?

I see that a lot of teachers use a shortcut method for commenting out multiple lines. They select a lot of lines, press a button or do something and everything selected get commented out. I would love to know this shortcut.

1 Answer

James Magnavacca
James Magnavacca
20,170 Points

Hello Elian! In the Treehouse Workspace you can comment out multiple lines in two ways.

  1. For line comments on a Mac you use cmd /, I believe it's ctrl / on Windows.
  2. For block comment it's alt cmd /, probably alt ctrl / on Windows.

Awesome, James. Thanks! Exactly what i was looking for.

I had a feeling it would be the same in Sublime Text and it is. This is gonna save me a lot of time. :)

Second is shift ctrl / if any other windows users want to know about this. :)