Building Your Learning Module...
Getting things ready for you!
Find videos you like?
Save to resource drawer for future reference!
Comments are notes in your code that JavaScript completely ignores. They're for you and other developers to understand what the code does and why!
//Two forward slashes
// This is a comment
console.log('Hello');Everything after // on that line is ignored
/* */Slash-star ... star-slash
/*
This is a comment
that spans multiple
lines
*/
console.log('Hello');Everything between /* and */ is ignored
Quick notes on one line
Longer explanations across multiple lines
///* */See how comments help explain code in a practical example
Tell why you did something, not what the code does
If it took you time to figure out, comment it
Mark things you need to come back to
Keep comments accurate and current
Don't write: i++ // increment i
Don't comment every single line
Remove comments that are no longer true
Fix the code instead of explaining why it's confusing
JavaScript skips them completely - they're just notes
Everything after // is a comment
Everything between /* and */ is a comment
Tell why you made a decision, not what the code does