简体   繁体   English

JavaScript对象中间的美元符号

[英]Dollar sign in the middle of JavaScript objects

I like to think I know JavaScript okay, but I've recently seen something interesting in one of the codebases I had access to (for a very limited time). 我想以为我知道JavaScript还可以,但是最近我在一个可以访问的代码库中看到了一些有趣的东西(在很有限的时间内)。 I saw a JavaScript object with a name that looked similar to this: 我看到了一个名称类似于以下内容的JavaScript对象:

Variable$Name$Example$Here = ...

In fact, I'm not even sure if that's a variable per-se, or a different type of JavaScript object (ie a primitive or not). 实际上,我什至不确定这是变量本身,还是其他类型的JavaScript对象(即是否是原始类型)。 Now I know that $ is usually used to denote an instance of a jQuery, but I haven't seen it in the middle of the object name. 现在,我知道$通常用于表示jQuery的实例,但是在对象名称的中间没有看到它。

Did they simply name it that way? 他们只是这样命名吗? Is there simply somewhere eg 是否只是在某个地方,例如

var Variable$Name$Example$Here = true;

... or am I completely missing something here? ...还是我在这里完全错过了什么?

Yes. 是。 It is simply the name of the variable. 它只是变量的名称。 $ is a valid character for a variable name. $是变量名的有效字符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM