Enough already


Alright, so anyone that knows me fairly well knows I enjoy coding Javascript more than most other languages.. Unfortunately, about 99% of what I code isn’t appropriate for posting to the web or else I would probably have my own Javascript library by now. I have a problem abstracting my code enough to generally useful, usually its hyper-specialized to do one thing very quickly, different story through, back on topic…I am ranting here.

Many popular Javascript libraries/frameworks make extensive use of the dollar symbol ($). Great, no problem, cool, its fun to do this in jQuery to get a reference to an element by its ID through CSS selectors:

$("#divID")

I won’t go into the other frameworks, since my point is this. Yes, the ECMAscript spec says:

7.6 Identifiers

This standard specifies specific character additions: The dollar sign ($) and the underscore (_) are permitted anywhere in an identifier.

So this is perfectly valid:

var the$subvar = "hello";

Valid…yes, recommended NO!

If you have ever had to dig through code that intersperses usage of the dollar function and dollar Identifier you find you quickly start to go cross eyed and begin mumbling while posting a rant to your website…

Comments are closed.