Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between defining variable as var $a=$() and var a?

Sometimes in JQuery we define variable as var $a=$() which is like declaring a function. So i want to know does it make any change if we define variable as var a only?

like image 988
Ranjit Singh Avatar asked Oct 03 '12 20:10

Ranjit Singh


1 Answers

If you mean:

var a = $(/* Object or Selector gets passed here */)

Then the only difference would be the name. Developers use $a to indicate that the value is already jQuery-ied. Leaving it off changes no functionality but would be a dis-service to future developers.

like image 166
Justin Niessner Avatar answered Sep 16 '22 19:09

Justin Niessner