coffeescript - 如何评论? “/ * this * /”不工作 [英] coffeescript - How to comment? "/* this */" doesn't work

查看:199
本文介绍了coffeescript - 如何评论? “/ * this * /”不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您在哪些方面可以在Coffeescript中评论?文档说您可以使用3个哈希符号来启动和关闭注释块。

  ### 
comments
go
here
###

有时可以使用以下两种格式

 `//反引号允许直接JavaScript,
// backtick不能在注释行(我想?)
`



$ b

b

由于这会得到很多意见,我想强调这里

  / *当 / * 时,



正如Trevor在对该问题的评论中指出的,这是一个正则表达式的注释!

解决方案

使用单个#符号

 #like this 

一个字符看起来很少;)



另外:

  ### 
此区块评论(适用于©-Copyright info) gets
传递给浏览器HTML / *这样! * /
###


In what ways can you comment in Coffeescript? The docs say you can use 3 hash symbols to start and close a comment block

###
  comments
  go
  here
###

I've found that I can sometimes use the following two formats

`// backticks allow for straight-javascript, 
 //but the closing backtick can't be on a comment line (I think?)
`

Are there any simpler ways to insert short comments in coffeescript?

Edit: do NOT use this style

Since this is getting a lot of views, I want to emphasize that this

/* comment goes here */

produces a MATH error when the /* is on its own line.
As Trevor pointed out in a comment on the question, this is a regex, NOT a comment !

解决方案

Use a single # sign

# like this

One character seems pretty minimal ;)

Also:

###
This block comment (useful for ©-Copyright info) also gets 
passed on to the browsers HTML /* like this! */
###

这篇关于coffeescript - 如何评论? “/ * this * /”不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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