JQuery:“var test”和“var test”之间的区别是什么?和“var $ test” [英] JQuery : What is the difference between "var test" and "var $test"

查看:264
本文介绍了JQuery:“var test”和“var test”之间的区别是什么?和“var $ test”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这些陈述有什么区别?我知道var $ test声明了一个jquery变量,但jquery变量与一般javascript变量的区别是什么?

what is the difference between these statements? I know that "var $test" declares a jquery variable, but what is the difference of a jquery variable with a general javascript variable ?

推荐答案

无。没有不同。 $是JavaScript标识符中的有效字符,但没有特殊含义。事实上,在7.6节的ECMAScript 3规范中,它表明

Nothing. No difference. $ is a valid character in a JavaScript identifier but has no special meaning. In fact, in the ECMAScript 3 specification in section 7.6 it states that


美元符号($)和下划线
(允许在
标识符中的任何位置使用_)。美元符号是
,仅用于机械
生成的代码。

The dollar sign ($) and the underscore (_) are permitted anywhere in an identifier. The dollar sign is intended for use only in mechanically generated code.

...虽然事件有现在可能已经过时了。实际上,最近的ECMAScript 5规范省略了最后的句子。

... although events have now probably rendered that recommendation obsolete. Indeed, the recent ECMAScript 5 spec omits the final sentence.

这篇关于JQuery:“var test”和“var test”之间的区别是什么?和“var $ test”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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