- Talent
- Javascript
- Forum
- Which symbol is used for comments in Javascript?
Write for both single and multi line comment
- Shubham
- 15 Jul
- 19 Answers
Providing comments is good habbit of programming, which helps other developer to understand the code or logic written.
For example if we are writting any comments for variable declaration or brief info then we can use Single line comment.
//count indicates the starting point [ its single line of comments]
var count = 0;Multiline comments.
/**
* Its multiline comment example
* It will be helpfull for others, what your code is doing.
* It is easy to read. any we can provide logic info.
* response{ [Object] } indicates the array object
* response getting from any service call or locally
* Similary here you can specify for other parts.
*/
function getTotalCount[response]{
var count = 0;
for[var value = 0; value < response.lenght; value++ ]{
count = count + response["itemsCount"];
}
}// FOR SINGLE LINE, /* */ FOR MULTI LINE
// for single line and /* */ for multiline
Single Line Comment: //
Multi Line Comments: /* */To create a single line comment in JavaScript, you place two slashes "//" in front of the code or text you wish to have the JavaScript interpreter ignore. When you place these two slashes, all text to the right of them will be ignored, until the next line.
1.Multiple-line C-style comments. Everything between /* and */ is a comment, for example:
/* This is a comment */ /* C-style comments can span as many lines as you like, as shown in this example */2.One-line comments of C++ style. These comments begin with // and continue up to the next line break:
// This is a one-line comment3.One-line comments with the HTML comment-opening sequence []. Consider this example:
This is also a one-line JS comment because JS ignores the closing characters of HTML-style commentsMainly 3 symbols are use for comments in JavaScript -1 multiline comments /* */ 2- single line of C++ style // 3- single line
- Talent
- Javascript
- Forum
- Which symbol is used for comments in Javascript?
Nội dung chính
- Right Answer is: //
- Types of JavaScript Comments
- JavaScript Single line Comment
- JavaScript Multi line Comment
- Which one of the following symbol is used for creating comments in the JavaScript * 1 point?
- Which symbol is used to create comments?
- Which of the following symbol is used for multiple line comments in JavaScript?
- What are the two types of comments in JavaScript?
Write for both single and multi line comment
- Shubham
- 15 Jul
- 19 Answers
Providing comments is good habbit of programming, which helps other developer to understand the code or logic written.
For example if we are writting any comments for variable declaration or brief info then we can use Single line comment.
//count indicates the starting point [ its single line of comments]
var count = 0;Multiline comments.
/**
* Its multiline comment example
* It will be helpfull for others, what your code is doing.
* It is easy to read. any we can provide logic info.
* response{ [Object] } indicates the array object
* response getting from any service call or locally
* Similary here you can specify for other parts.
*/
function getTotalCount[response]{
var count = 0;
for[var value = 0; value < response.lenght; value++ ]{
count = count + response["itemsCount"];
}
}// FOR SINGLE LINE, /* */ FOR MULTI LINE
// for single line and /* */ for multiline
Single Line Comment: //
Multi Line Comments: /* */To create a single line comment in JavaScript, you place two slashes "//" in front of the code or text you wish to have the JavaScript interpreter ignore. When you place these two slashes, all text to the right of them will be ignored, until the next line.
1.Multiple-line C-style comments. Everything between /* and */ is a comment, for example:
/* This is a comment */ /* C-style comments can span as many lines as you like, as shown in this example */2.One-line comments of C++ style. These comments begin with // and continue up to the next line break:
// This is a one-line comment3.One-line comments with the HTML comment-opening sequence []. Consider this example:
This is also a one-line JS comment because JS ignores the closing characters of HTML-style commentsMainly 3 symbols are use for comments in JavaScript -1 multiline comments /* */ 2- single line of C++ style // 3- single line
Which one of the following symbols is used for creating comments in the javascript?
\\
//
\* *\
\* */
Right Answer is: //
SOLUTION
The single-line comments always start with the “//” and any text written in between the “// “and the end of the line is considered a comment and ignored by the JavaScript.
About Us
McqMate.com is an educational platform, Which is developed BY STUDENTS, FOR STUDENTS, The only objective of our platform is to assist fellow students in preparing for exams and in their Studies throughout their Academic career.
what we offer ?» We provide you study material i.e. PDF's for offline use.
» We take free online Practice/Mock test for exam preparation.
» Each MCQ is open for further discussion on discussion page.
» All the services offered by McqMate are free.
I
Indresh · Follow
Tutor III · 8.24K points
Which one of the following symbol is used for creating comments in the javascript
[A] \\
[B] //
[C] \* *\
[D] \* */
Category: JavaScript
Be the first to upvote this question
0 Upvote Share
Share This:
Share this question in group:
Login required to perform this action.
Create an account | Already have account? Login
Close
- JavaScript comments
- Advantage of javaScript comments
- Single-line and Multi-line comments
The JavaScript comments are meaningful way to deliver message. It is used to add information about the code, warnings or suggestions so that end user can easily interpret the code.
The JavaScript comment is ignored by the JavaScript engine i.e. embedded in the browser.
Advantages of JavaScript comments
There are mainly two advantages of JavaScript comments.
- To make code easy to understand It can be used to elaborate the code so that end user can easily understand the code.
- To avoid the unnecessary code It can also be used to avoid the code being executed. Sometimes, we add the code to perform some action. But after sometime, there may be need to disable the code. In such case, it is better to use comments.
There are two types of comments in JavaScript.
- Single-line Comment
- Multi-line Comment
It is represented by double forward slashes [//]. It can be used before and after the statement.
Let’s see the example of single-line comment i.e. added before the statement.
Test it NowLet’s see the example of single-line comment i.e. added after the statement.
Test it NowIt can be used to add single as well as multi line comments. So, it is more convenient.
It is represented by forward slash with asterisk then asterisk with forward slash. For example:
It can be used before, after and middle of the statement.
Test it NowWhich one of the following symbol is used for creating comments in the JavaScript * 1 point?
To create a single line comment in JavaScript, you place two slashes "//" in front of the code or text you wish to have the JavaScript interpreter ignore.
Which symbol is used to create comments?
The single line comment is //. Everything from the // to the end of the line is a comment. To mark an entire region as a comment, use /* to start the comment and */ to end the comment.
Which of the following symbol is used for multiple line comments in JavaScript?
Creating Multi-line Comments Although a single line comment is quite useful, it can sometimes be burdensome to use when disabling long segments of code or inserting long-winded comments. For this large comments you can use JavaScript's multi-line comment that begins with /* and ends with */.
What are the two types of comments in JavaScript?
There are two types of comments in JavaScript..
Single-line Comment..
Multi-line Comment..