Please enable JavaScript to use CodeHS

CodeHS Glossary


Comment Out JavaScript

For a longer explanation on comments, see [here][1]. Commenting out code makes the computer ignore it, so it does not run. The computer ignores lines of code that begin with `//` or that are in between `/*` and `*/` Sometimes, you want to test a version of your code but not run all of it. Instead of deleting your code to re-write it later, you can just comment out some of your code like this: function start() { setup(); doFirstThing(); // doSecondThing(); } This program will not run the `doSecondThing();` function, since it is commented out. This lets you just test your program's `setup()` and `doFirstThing()` functions. You can also comment out many lines at once using multiline comments like this: move(); move(); putBall(); move(); turnLeft(); putBall(); /* move(); move(); turnLeft(); putBall(); move(); turnLeft(); */ The above code will only run the first 6 commands and skip the rest, since they are commented out using `/*` and `*/` [1]: http://codehs.com/glossary/term/18