/** * Request timeout in milliseconds. * @type {number} */ goog.example.TIMEOUT_IN_MILLISECONDS = 60;
着实没明白什么意思
@tyoe {number} 标记之后,编译器就能主动识别常量?
Note that @const
does not necessarily imply CONSTANT_VALUES_CASE
. However, CONSTANT_VALUES_CASE
does imply @const
.
/** * Request timeout in milliseconds. * @type {number} */ goog.example.TIMEOUT_IN_MILLISECONDS = 60;
The number of seconds in a minute never changes. It is a constant value. ALL_CAPS
also implies @const
, so the constant cannot be overwritten.
The open source compiler will allow the symbol it to be overwritten because the constant is not marked as @const
.
/** * Map of URL to response string. * @const */ MyClass.fetchedUrlCache_ = new goog.structs.Map();
In this case, the pointer can never be overwritten, but value is highly mutable and not constant (and thus in camelCase
, not ALL_CAPS
).
这不是一段注释吗?
另外,JS有常量?
类似JAVA DOC
用来生成文档的注释,{}里面写的是类型,JS里面的类型有string、number、boolean等等
搜索下你就知道是什么了