11736 endSize: u,
11737 property: o,
11738 speed: i,
11739 callback: function () {11740 if (11741 (n[0].AUtoggleInteration++,11742 n[0].AUtoggleInteration === n[0].AUinterations)11743 ) {11744 var e = t.callback(p, s);11745 return t.postfunction(p, s), e;11746 }11747 t.postfunction(p, s);11748 },11749 });
11750 }
11751 }),
11537 "AU.accordion.Toggle cannot find the target to be toggled from inside aria-controls.\nMake sure the first argument you give AU.accordion.Toggle is the DOM element (a button or a link) that has an aria-controls attribute that points to a div that you want to toggle.",
11538 );
11539 (s.style.display = "block"),
11540 (function (o) {11541 e.animate.Toggle({11542 element: s,11543 property: "height",11544 speed: a || 250,11545 prefunction: function (e, a) {11546 "opening" === a11547 ? ((e.style.display = "block"),11548 "function" == typeof i.onOpen && i.onOpen())11549 : "function" == typeof i.onClose && i.onClose(),11550 t(o, 0, a),11551 n(o, a);11552 },11553 postfunction: function (e, t) {11554 "closed" === t11555 ? ((e.style.display = ""),11556 (e.style.height = ""),11557 "function" == typeof i.afterClose && i.afterClose())11558 : ((e.style.display = ""),11559 (e.style.height = ""),11560 "function" == typeof i.afterOpen && i.afterOpen()),11561 n(e, t);11562 },11563 });11564 })(c);11565 }
11566 return !1;
11567 }),
3945 : (v = Y.access(e, "fxshow", { display: l })),
3946 o && (v.hidden = !g),
3947 g && le([e], !0),
3948 p.done(function () { 3949 for (r in (g || le([e]), Y.remove(e, "fxshow"), d)) 3950 S.style(e, r, d[r]); 3951 })), 3952 (u = ut(g ? v[r] : 0, r, p)),
3953 r in v ||
3954 ((v[r] = u.start), g && ((u.end = u.start), (u.start = 0)));
3945 : (v = Y.access(e, "fxshow", { display: l })),
3946 o && (v.hidden = !g),
3947 g && le([e], !0),
3948 p.done(function () { 3949 for (r in (g || le([e]), Y.remove(e, "fxshow"), d)) 3950 S.style(e, r, d[r]); 3951 })), 3952 (u = ut(g ? v[r] : 0, r, p)),
3953 r in v ||
3954 ((v[r] = u.start), g && ((u.end = u.start), (u.start = 0)));
3945 : (v = Y.access(e, "fxshow", { display: l })),
3946 o && (v.hidden = !g),
3947 g && le([e], !0),
3948 p.done(function () { 3949 for (r in (g || le([e]), Y.remove(e, "fxshow"), d)) 3950 S.style(e, r, d[r]); 3951 })), 3952 (u = ut(g ? v[r] : 0, r, p)),
3953 r in v ||
3954 ((v[r] = u.start), g && ((u.end = u.start), (u.start = 0)));
Writing functions within loops tends to result in errors due to the way the function creates a closure around the loop. For example:
for (var i = 0; i < 10; i++)
funcs[i] = function() {
return i;
};
}
In this case, you would expect each function created within the loop to return a different number. In reality, each function returns 10, because that was the last value of i in the scope.
let
or const
mitigate this problem.
for (let i = 0; i < 10; i++) {
funcs[i] = function() {
return i;
};
}
In this case, each function created within the loop returns a different number as expected.
for (let i = 10; i; i--) {
(function() { return i; })();
}
while(i) {
const a = function() { return i; };
a();
}
do {
function a() { return i; };
a();
} while (i);
let foo = 0;
for (let i = 0; i < 10; ++i) {
//Bad, `foo` is not in the loop-block's scope and `foo` is modified in/after the loop
setTimeout(() => console.log(foo));
foo += 1;
}
for (let i = 0; i < 10; ++i) {
//Bad, `foo` is not in the loop-block's scope and `foo` is modified in/after the loop
setTimeout(() => console.log(foo));
}
foo = 100;
let a = function() {};
for (let i = 10; i; i--) {
a();
}
for (let i = 10; i; i--) {
const a = function() {}; // OK, no references to variables in the outer scopes.
a();
}
for (let i = 10; i; i--) {
const a = function() { return i; }; // OK, all references are referring to block scoped variables in the loop.
a();
}
const foo = 100;
for (let i = 10; i; i--) {
const a = function() { return foo; }; // OK, all references are referring to never modified variables.
a();
}
//... no modifications of foo after this loop ...