-1

Angularjs specific code:

var deferred = $q.defer(),
    nextTransClass, prevTransClass;

What's the meaning of this? I have never seen such variable assignment.

DarkLeafyGreen
  • 69,338
  • 131
  • 383
  • 601

1 Answers1

5

They're not all assigned to the same variable; they're just being declared on the same line.

The code above is equivalent o the following:

var deferred = $q.defer();
var nextTransClass;
var prevTransClass;

P.S. There's nothing Angular specific about this (besides for $q.defer(), obviously). This is just standard vanilla JavaScript.

Joseph Silber
  • 214,931
  • 59
  • 362
  • 292
  • @Joseph: in this case, what would be the type of "var"? would it have different types? (i think i'm missing something because i come from a strongly-typed background. :) ) – OJ Raqueño Aug 04 '13 at 15:59
  • 2
    @OJRaqueño - `var` does not indicate the type; it's just a generic form of variable declaration. – Joseph Silber Aug 04 '13 at 16:01