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 Numbers Working with Numbers Convert Strings to Numbers

Commenting out multiple lines of JS using //

How does Guil quickly comment out multiple lines of JS using // (some sort of keyboard shortcut I presume) ?

dude i was wondering the same thing thanks for posting this so i didnt have to do it myself and wait for an answer haha

This is so funny I was blown away when he added 5 comments in 2 seconds.

4 Answers

highlight all the lines then: command + / on mac or ctrl + / on windows

Andrew McKinnon
Andrew McKinnon
2,881 Points

thank you, i was wondering the same thing

Hi, you can just select all the lines you want to comment or uncomment and then, do the following:

On Windows: ctrl + / On Mac: cmd + /

If that helped you, please mark as best answer to indicate other students your issue is resolved!

Hi! there is 2 ways of comment by keyboard shortcut:

1 - Select the text to want to comment and then press 3 keys: "ctrl" "+" "/" (type it at the same time without the ""). This way you will comment it out with //

2 - Select the text to want to comment and then press 3 keys: "ctrl" "shift" "/" (type it at the same time without the ""). This way you will comment it out with /* */

I knew this would be here... thank you!