naming conventions - Why do I see JavaScript variables prefixed with $? -


This is like a meta-question I have seen here that many snippets of JavaScript are dollar sign prefixes (for example , The name shown in question is named $ id on the second line of the snippet. I am not referring to jQuery or other libraries I know well that it is valid, but it seems awkward to do so when it is not necessary. Why do people give their names like this? Is it familiar with server-side language like PHP is taking in your Javascript code?

I thought it was to recognize a variety as a jQuery object, for example when you later chose a variable to eliminate duplicate selection, but I did not have any relevant conferences have seen. Syntaxally, dollar signature does not mean anything - for interpreter, it's just another character, such as > _ or q . But many people use jQuery and other similar frameworks, they can use variables, which include jQuery objects so that they can be easily identified, and thus not mixed with things like integer or string Ho. By prefixing such a variable with jq_ , you can easily adopt the same conference and it will have the same effect.

Basically, this is a raw type .


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -