Answer the question
In order to leave comments, you need to log in
Why put $ in front of the variable?
I dug into someone else's code and found that in classes, in the names of class properties, the developer writes some variables like this: this.$variable
Why $
?
Answer the question
In order to leave comments, you need to log in
There is such a practice - the buck is placed in front of those variables in which there should be objects.
Just to make it easy to visually distinguish them from other variables.
The language itself does not care, but the programmer sometimes needs to distinguish them.
It was originally the practice to refer to jQuery objects this way.
But I, for example, also designate ordinary DOM nodes in the same way.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question