javascript中的三个斜杠有什么作用? [英] What does the three slashes in javascript do?

查看:195
本文介绍了javascript中的三个斜杠有什么作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我还是Javascript的新手,所以当我的编辑突出显示它时,我很感兴趣。它到底是做什么用的?

I'm still new to Javascript so when my editor highlights it I'm intrigued. what exactly does it do?

示例: ///事后要去的地方

推荐答案

一些文档生成器将三个斜杠///视为向JavaScript引入文档注释。

Some documentation generators regard three slashes /// as introducing documentation comments to JavaScript.

参见

http://msdn.microsoft.com/en-us/library/bb514138(v = vs.110).aspx

因此,就JavaScript而言,三个斜杠的工作方式与两个斜杠相同(它是一个注释到行尾),但文档生成器可以解释三个斜杠来指示文档部分。

So three slashes work the same as two slashes as far as JavaScript is concerned (it's a comment-to-end-of-line), but three slashes can be interpreted by documentation generators to indicate a documentation section.

示例:

  function getArea(radius)
  {
      /// <summary>Determines the area of a circle that has the specified radius parameter.</summary>
      /// <param name="radius" type="Number">The radius of the circle.</param>
      /// <returns type="Number">The area.</returns>
      var areaVal;
      areaVal = Math.PI * radius * radius;
      return areaVal;
  }

这篇关于javascript中的三个斜杠有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆