views:

322

answers:

5

I want a variable like $ that is sort of special, but I'm already using jQuery, so $ is taken.

+1  A: 

Underscore is the only one I can think of. You can put a few together like _$_.

Starting in JavaScript 1.5, you can use Unicode such as å.

Nosredna
+5  A: 

Unfortunately, older javascript supports letters, numbers, underscores, and $ in identifiers. In javascript 1.5 and later you can use Unicode characters, but that would be a very bad idea as they can be a pain to enter into most editors, and certainly aren't something you would want to have to type very often.

Source

Brian Ramsay
That's the source I was looking at. :-)
Nosredna
+1  A: 

The one I like it best:

λ = Function;

Unfortunately is very difficult to type it.

Ionuț G. Stan
+1  A: 

If you want a special variable like $ but $ is already taken by jQuery, why not use something that starts with $, like $a or similar? Just make sure it's one that jQuery doesn't also define.

aem
jQuery can handle `$` conflicts, so `$` could be just fine. After all, jQuery borrowed the dollar from prototype.js
Ionuț G. Stan
+1  A: 

Prototype uses $ and a $$. If you're using jQuery, you could use $$. However, unless its really well documented, this may be a bad idea--especially if someone else has to maintain this code after you've moved on.

Justin Johnson