Comments in JavaScript

Notes:

JavaScript comments:
Comments are ignored by browsers
Comments have no effect on the execution of a program
Comments are used to increase the readability and understand ability of the source code
Comments are used to document the source code
Comments are used to explain code logic, so that other developers can understand the code easily

Types of comments in JavaScript:
There are 2 types of comments in JavaScript
Single line comment (// comment goes here)
Multiline comment (/* comment goes here */)

Single line comment:
// followed by anything written in a single line is treated as a comment

Multiline comment:
anything written in between /* and */ is treated as a comment

Interview Questions:

1. JavaScript codes are executed by ________________
a. browser
b. server
c. JVM
d. AVM
Answer: a

2. Every JavaScript statement must end with ________________
a. colon
b. semicolon
c. parenthesis
d. double quotations
Answer: b