JavaScript in 60 Seconds


Sometimes you want to add a note along with your code to explain it to the person coming after you. That’s what comments are for.

Single line comments

Single line comments start with // and is in effect until the end of the current line.

5+5; // this is a comment. Anything after // will not be executed // console.log(5); // this code is now commented out. This is a good way of // disabling some code without deleting it

Multi Line comments

Comments can span across lines if you start with /* and end with */. Anything between those markers is considered a comment.

/* TODO: 1. Clean this code up 2. Write better function */ /* alert() */ /* console.log(); alert() */