Skip to content Skip to sidebar Skip to footer

Multiple Values Are Assigned To One Variable. How Does This Work?

Angularjs specific code: var deferred = $q.defer(), nextTransClass, prevTransClass; What's the meaning of this? I have never seen such variable assignment.

Solution 1:

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.

Post a Comment for "Multiple Values Are Assigned To One Variable. How Does This Work?"