且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将多个值分配给一个变量.这是如何运作的?

更新时间:2023-02-11 21:53:58

它们并没有全部分配给同一个变量.它们只是在同一行上声明.

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;

PS .对此,没有Angular的特定要求(显然,除了 $ q.defer()之外).这只是标准的原始JavaScript.

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