3
Contributors
6
Replies
37
Views
2 Years
Discussion Span
Last Post by Troy III
1

Technically nothing, but the ones with $ usually help to identify jQuery elements easily.

0

the difference between var $name and var name is that whenever you see a person using $name in his code instead of normal name, avoid talking to him, avoid conversing with him, avoid WORKING with him, and if your girlfriend happens to know him drop her too, even if he's family. Otherwise take on him and make him your slave, the only thing they are good for, anyway :)

0

Not really. You see, prefixing string-variable names with a certain symbol like $, is not all that bad...
Seeing my uncle do that, would feel quite normal to me. -He is from '70-ties!

But this is JavaScript. :)

Edited by Troy III

0

LOL. True, but it's an allowed character for a variable, so why not use it if it can help identifying variables easily ;)

0

:) That's because in JavaScript everything is variable.

Prefixing a variable-name [initially] containing a String (object or literal) with $ symbol - is plain dumb, for who knows what it may become few lines after.

Furthermore JavaScript is a Dynamic Types language, treating it as Static is simply wrong.
A plain literal string depending on a stituation may change its type from string to any other js-type, and that's a beauty of it, it's Alive!

Edited by Troy III

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.