JavaScript multiline comments, also known as block comments, start with a forward slash followed by an asterisk (/*) and end with an asterisk followed by a forward slash (*/).
Multiple line comments are used to prevent the execution of many lines of code.
Syntax
/* This is
Multiple line or block
Comment
*/
Example
/*
We can write anything here.
console.log("this is multiple line or block comment");
function calculator(){
// some code
}
*/
console.log('Avengers the multiline');
Output
Avengers the multiline
Why do we need to use multiple lines or block comments in JavaScript
A comment is usually used to explain the code to the developers and comment to create a more readable code.
If we have one function, but for some reason, we need to stop that execution for a while, we comment on that function. So that function does not execute.
Multiple Line or Block Comments are also used for formal documentation.
Best use of multiple lines or block comment
/*
## getMovieList function ##
suggetion :- In the fetch function use constant url instead of custom.
explain : - In this function we get our movieList by using our api url.
*/
async function getMovieList() {
try {
const res = await fetch("https://movie.com/api/movielist");
if (res.status === 1) {
return res.data;
} else {
throw res;
}
} catch (err) {
console.log(err.message || "something went wrong !");
}
}
In the above example, we create multiple lines or block comments, and inside that block, we suggest and explain our getMovieList() function.

Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.
You are a very clever individual!