Famous javascript libraries,
- jQuery
- prototypejs
- mootools
- scriptaculous
all uses $. What’s the significance of $ ?
and also, even php uses it to declare variables. I am sure some other languages uses it too.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s just a character that can be part of identifiers in JavaScript. No special significance outside of the fact that it’s distinctive-looking. It’s easy to recognize when you’re scanning over code.
Now, in other languages, it can (and does) mean all sorts of things. The term sigil has come into fashion when referring to “special” characters that have syntactic significance in a programming language, specifically as modifying the semantics of a reference to a variable. In JavaScript, I would not use that term for “$” because it doesn’t mean anything in particular to the interpreter.
edit — as noted in a comment, “$” has a role in JavaScript regular expression syntax, but I wouldn’t consider that related in any way to its use in variable names. (Maybe somebody would; I don’t know.)