Sitemap
Firdavsi Web Dev

Firdavsi Web Dev

Hey there! I’m Firdavsi, a Math Lover. Obsessed with Computer Programming, Design and Science. Learn Web Development at https://w7school.com

JavaScript Comments

1 min readDec 15, 2021

--

Press enter or click to view image in full size
javascript comments

JavaScript Comments — Lesson 1

In this article and video you’ll learn about JavaScript Comments

What is code commenting?

JavaScript is a programming language. And a programming language is a way to talk to computers to tell/command them to do something by writing so called “code”.

Get Firdavsi Web Dev’s stories in your inbox

Join Medium for free to get updates from this writer.

Codes in a programming language are usually executed to do something.

But comments in code meant to leave notes to yourself and your future self, for other developers, for readability and prevent other JavaScript codes from executing or doing something by making them inactive.

So JavaScript comments can be used to explain JavaScript code for your self, for other developers/programmers and make JavaScript code inactive.

There are 2 ways to write comments in JavaScript

1. Single Line Comments

To write a single line comment in JavaScript you use 2 forwards slashes and everything you type after that is a comment on that line like so:

// This is a single line comment

2. Multi Line Comments

To create a multi line comment you type /* and */ everything in between is going to be comment.

/* 
this is a
multi-line comment.
Please leave meaningful notes in here
*/

Thanks for reading. Follow for more JavaScript and Design articles and videos.

--

--

Written by Firdavsi Web Dev

Hey there! I’m Firdavsi, a Math Lover. Obsessed with Computer Programming, Design and Science. Learn Web Development at https://w7school.com