Skip navigation

Tag Archives: comment


You can comment in two ways in JavaScript code.

1) First one is to comment single line. For that we use two front slashes like //. Then the entire line will be considered as comment

Example

// This is a comment in JavaScript code

2) Second one is to comment multiple lines. For that we use start with /* and end with */
Example

/* This is the multi line
comment is JavaScript code */

So, where is the shock???

When you are using regular expression, be careful because you may encounter error.

/*
var reg = /a*/.match(str);
*/

So even when using comments, you should be careful…

Hope this will help…