2013-06-09

dollar sign in JavaScript

lots JavaScript libs use dollar sign “$” as the name of their primary function.

It seems, it started with the prototype lib, then others picked it up, in particular jQuery.

here's a quote from stackoverflow

As far as I can see, it's not recommended to use because the ECMAScript specification 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.

Update: The above refers to ECMA-262 3.0. However, this is no longer the latest edition. Currently, 5.1 is the latest edition. In ECMA-262 5.1 the above text is changed to:

The dollar sign ($) and the underscore (_) are permitted anywhere in an IdentifierName.

That is, it seems that they dropped the "restriction" or whatever you want to call it.

So, is this the case where practice forced a chance in spec?