Luke B
Luke B

Reputation: 2146

What does /// do in JavaScript?

I was adding some comments to my code using Notepad++, and instead of typing //check for null I accidentally typed ///check for null. I noticed that this caused my text to be colored differently, so presumably it has a different function. When I tried to Google it, Google seemed to replace my javascript /// with just javascript.

So, my question: What does /// do in JavaScript?

Also, this is not a duplicate of this question because that question is about C++, I'm talking about Javascript.

Upvotes: 0

Views: 273

Answers (1)

Karl Reid
Karl Reid

Reputation: 2217

It doesn't mean anything special in Javascript. // is a comment, and anything after it until a line break is just part of the comment.

Notepad++ displays it differently because apparently in C#-land /// is used for writing documentation in comments that appears in Intellisense - see this answer, and this one too. So Notepad++ treats them different, and still does this in Javascript mode for some reason.

As for Google, it strips special characters like / from searches these days.

Upvotes: 4

Related Questions