Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does /// mean in JavaScript?

Tags:

javascript

The double forward slash // is a comment in JavaScript, but what does a triple forward slash /// mean? The reason I am asking is the code breaks when I remove a line that has ///. Which leads me to believe that /// is not a comment.

like image 547
developer747 Avatar asked Mar 05 '12 18:03

developer747


4 Answers

Could be a reference directive

Does it look like this?

/// <reference path="jquery-1.8.2.js" />
like image 147
John Wu Avatar answered Nov 15 '22 18:11

John Wu


These are all comments:

//
// ..............
//..............
// //////////////
////////////////
///
/// ..............

since the comment extends from the // to the end of the line.

Edited to add: Of course, there are various contexts where neither // nor /// introduces a comment. For example:

'///'       <-- this is a string
"///"       <-- this is a string (same as previous)
/[///]/     <-- this is a regular expression (same as /\//)
/* /// */   <-- this is a comment delimited by /*...*/
/\///3      <-- this is /\// divided by 3, i.e., not-a-number
like image 31
ruakh Avatar answered Nov 15 '22 17:11

ruakh


A commented out slash character in the code.

If it is in a regular expression, please provide the context/complete line of code to allow quality explanations to be provided.

like image 1
Mark Schultheiss Avatar answered Nov 15 '22 17:11

Mark Schultheiss


In Javascript anything that begins with at least 2 //, is a comment, adding one more would make no difference as far as the code not working.

like image 1
Dylan Cross Avatar answered Nov 15 '22 17:11

Dylan Cross