i find it everywhere, like this.
function($) {
$.test = { some code }
}
what does it mean?
Think of $
just like any other variable. For jQuery, it's the jQuery object, which is pretty powerful. But it's just like any other variable; you could write your own $
if you wanted to, for example.
It's an unusual variable name, yes, but there's nothing magical about it. The .something
is just a property of the variable $
. It's no different than writing obj.something
, except the variable name is $
instead.
The other non-alphanumeric character you can use in JavaScript as a variable name is _
(the underscore). It's used in some other libraries, like underscore.js . But again, there's nothing special about using _
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With