🍪 Bite Size #1: Comments in JavaScript
The two difference of comments in JavaScript code and their use cases
There are two types of comments in JavaScript:
Single-Line Comment -
//Single-line comments start with two slashes//. Anything after//on the same line will not be executed.
Example:// My cup is empty.
let cup = 0;
// Fill it please!
let coffee = 5;
cup = coffee;
// Thanks!
console.log(`I have ${cup} cups of coffee now! ☕`)Multi-line Comments -
/* */Multi-line comments start with/*and end with*/. Everything between these symbols will not be executed.
Example:/*
Did you know that whales cannot breathe underwater?
The average whale can hold its breath for about 60 minutes.
*/const whale = {type: mammal;
holdBreath: 60;
swim: true;
}
Use cases:
Explain code – Describe what specific blocks or lines do for clarity.
Leave reminders – Note tasks or improvements using TODOs or FIXMEs.
Debug code – Temporarily disable lines without deleting them.
Document functions – Describe parameters, return values, and behavior.
Improve collaboration – Help others (and future you) understand the logic.
This is Random Nice Stuff’s Nice Bits. Tiny, bite-sized, digestible bits of randomness I’ve found along the way. No rules. Just nice bits.



