Q
What is the purpose of using comments in JavaScript?

Answer & Solution

Answer: Option b
Solution:
Comments improve code readability by explaining code logic.
Related Questions on Average

When breaking a long line in JavaScript, which of the following is a recommended practice?

A). Break lines randomly for variety

B). Break lines at logical points

C). Break lines only at the end of statements

D). Never break lines, keep them as is

What is the purpose of using meaningful variable and function names in JavaScript?

A). To confuse other developers

B). To reduce line length

C). To convey intent clearly

D). To bypass syntax rules

What happens if a line break is placed inside a string without appropriate handling in JavaScript?

A). It throws a syntax error

B). It causes a runtime exception

C). It ignores the line break

D). It creates a multiline string

What is the recommended maximum line length in JavaScript?

A). 80 characters

B). 100 characters

C). 120 characters

D). 150 characters

Which of the following is a code formatting tool for JavaScript?

A). Prettier

B). Babel

C). Webpack

D). ESLint

Which character is used to indicate a comment in JavaScript?

A). //

B). --

C). **

D). %%

What character sequence is used for a line break in JavaScript strings?

A). \n

B). \t

C). \r

D). \b

In ES6, what character is used to indicate multiline strings in template literals?

A). Backslash ()

B). Forward Slash (/)

C). Backtick (`)

D). Single Quote (')

In JavaScript, what is the purpose of maintaining consistent line lengths?

A). It reduces code performance

B). It improves code readability

C). It increases code execution time

D). It limits code functionality

What is the purpose of using meaningful variable and function names in JavaScript?

A). To confuse other developers

B). To reduce line length

C). To convey intent clearly

D). To bypass syntax rules