Learn JavaScript
Lesson 1 - Introduction To JavaScript
Lesson 3 - Control Flow
Lesson 4 - Functions
Lesson 5 - Basic Data Structures
Lesson 6 - Basic String Operations
Lesson 7 - Basic Array Operations
Lesson 8 - Exception Handling
Lesson 9 - Packages
Lesson 10 - User Input
Comments are short notes, describing the purpose of a specific code block. JavaScript ignores comments when running your code.
Using comments is one of the essential best practices that increases code understandability and is helpful when working as a team.
In JavaScript, you have two types of comments available:
// Initializing variable let x = 10; console.log("Value of x:", x);
For example:
/* Function to add two numbers Return value: integer */ function addNum(a, b) { return a + b; } console.log("Result:", addNum(10, 10));
See how we used the multi-line comment in the code above. Don't get scared about the function, we'll discuss it later in this course.