JavaScript中的双斜线意味着什么?

And*_*rde 1 javascript jquery

我在剧本中找到了这篇文章

var name = project.SMALL_WIDTH//p.containerWidth() /// 2//project.WIDTH / 4
Run Code Online (Sandbox Code Playgroud)

双刃和三刃是什么意思?

Ale*_*pin 7

双斜线是评论.三重斜杠并不意味着什么特别,但它可能是在分裂之前添加的评论.

var a = 10 / 2;
var a = 10 /// 2;
Run Code Online (Sandbox Code Playgroud)


Nat*_*han 7

///IS(最有可能)有只瓜分注释的部分.但是,它们对代码没有任何影响.之后,一切都//在JavaScript代码不被浏览器呈现.你可以这样做,它仍然可以工作:

<script type="text/javascript">
// Hello! I'm a comment! ///////////////// these slashes don't do anything as they're in a comment.
// The double slashes tell the browser not to render it.
</script>
Run Code Online (Sandbox Code Playgroud)

此外,您可以执行多行注释:

<script type="text/javascript">
/*
This is a 
multiple 
line 
comment!
*/
</script>
Run Code Online (Sandbox Code Playgroud)

如您所见,JavaScript中的多行注释与CSS注释非常相似.