Comments in javascript
JavaScript comments are used to explain the code to make it more readable. It can be used to prevent the execution of a section of code if necessary.
List of comments
Name | Description |
---|---|
Single line Comment | single-line comments start with //. |
Multi line Comment | multi-line comments start with /* and end with */. |
Syntax:
// A single line comment
/* It is multi line comment.
It will not be displayed upon
execution of this code
*/
Example: In this example, we are using single-line comments and multiline comments.
// A single line comment
console.log("Hello Geeks!");
/* It is multi line comment.
It will not be displayed upon
execution of this code */
console.log("Multiline comment in javascript");
Output
Hello Geeks! Multiline comment in javascript
JavaScript Basics
JavaScript is a versatile, lightweight scripting language widely used in web development. It can be utilized for both client-side and server-side development, making it essential for modern web applications. Known as the scripting language for web pages, JavaScript supports variables, data types, operators, conditional statements, loops, functions, arrays, and objects. With JavaScript, you can create dynamic, interactive, and engaging websites.
These are the basics that you need to learn before deep dive into JavaScript:
Table of Content
- Variables in JavaScript
- Data type in JavaScript
- Conditional statements in javascript
- Function in Javascript
- Looping in javascript
- Comments in javascript
- Operators in javascript