Javascript - Syntax : Comments Flashcards

1
Q

What are comments in JavaScript used for?

A

To leave notes for other developers or ourselves that the computer will ignore during execution.

Comments can explain code functionality, provide instructions, or add annotations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a Single Line Comment in JavaScript?

A

Represented by //; anything after // on the right of the same line is ignored by the computer.

It is used for brief comments on a single line.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a Multi Line Comment in JavaScript?

A

Represented by /* and */; anything between these symbols is ignored until the closing symbol is reached.

It allows for comments that span multiple lines.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

True or False: If comment symbols are not correctly used, no code will be executed.

A

True

This applies to both single-line and multi-line comments.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Fill in the blank: Single Line Comments in JavaScript are represented by _______.

A

//

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Fill in the blank: Multi Line Comments in JavaScript start with _______ and end with _______.

A

/*, */

How well did you know this?
1
Not at all
2
3
4
5
Perfectly