there is no difference between var $test and var test . but itβs always useful to know what data is in your variable: (for example, if someone just wants to change the function in your code without having to read or use console.log to find out what is in it) / p>
Here are some examples:
var arrTest = [1, 2, a, b, c], //Array objTest = {test: 1, test2: 2}, //Object strTest = "test", //String intTest = 4, //integer $test = $("#test") //jqueryObject
but it will also work as follows
var Test1 = [1, 2, a, b, c], //Array test2 = {test: 1, test2: 2}, //Object Test3 = "test", //String Test4 = 4, //integer $test = $("#test") //jquery Object
I think the jQuery $() form confuses you.
Jquery is basically a function set in the variable name $ :
var $ = function(e){
but you can use $somethingelse as a variable.
meo May 21 '10 at 9:40 a.m. 2010-05-21 09:40
source share