Possible Duplicate:
Why would a JavaScript variable start with a dollar sign?
I am not sure what $scope and $defer are but they just seem to work.
function xyz($scope, $defer) {
xyz = this;
this.defer = $defer;
this.scope = $scope;
this.scope.test = function(re) {
console.log(this,arguments);
}
}
Generally these days devs name a variable
$somethingto flag that it is an object type of a wrapping framework. For example, to cache a jQuery object, it makes sense to use$this = $(this);That being said, there’s nothing special about the dollar sign. Just a heads up for devs.
A bit of history and reasoning; ECMAScript 3 says:
Whereas ECMAScript 5 says:
So when someone says “Hey you’re not supposed to use a dollar sign in your var cuz it’s for MECHANICALLY-GENERATED code!” you can say “Psh, ECMA 5, hello?”