(t/= d/2)在此代码中的含义是什么?

Wil*_*ill 2 javascript jquery easing

jquery.easing插件中有许多像这样的方法:

easeInOutQuint: function (x, t, b, c, d) {
    if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
    return c/2*((t-=2)*t*t*t*t + 2) + b;
}
Run Code Online (Sandbox Code Playgroud)

(t/=d/2) 正在严厉惹恼jshint!

Linting assets/js/_main.js ...ERROR
[L119:C13] E030: Expected an identifier and instead saw '='.
    if ( (t/=d/2) < 1) {
[L119:C14] E020: Expected ')' to match '(' from line 119 and instead saw 'd'.
[L119:C19] W116: Expected '{' and instead saw '<'.
[L119:C19] E030: Expected an identifier and instead saw '<'.
[L119:C19] W030: Expected an assignment or function call and instead saw an expression.
[L119:C20] W033: Missing semicolon.
[L119:C21] W030: Expected an assignment or function call and instead saw an expression.
[L119:C22] W033: Missing semicolon.
[L119:C22] E030: Expected an identifier and instead saw ')'.
[L119:C22] W030: Expected an assignment or function call and instead saw an expression.
[L119:C23] W033: Missing semicolon.
Run Code Online (Sandbox Code Playgroud)

(为简洁起见,删除了重复的JS Lint输出行)

这是(t/=d/2)做什么的?

我想解决它(告诉咕噜忽略它,我现在已经做了)但我不明白它在做什么.正则表达某种?请注意,td作为参数传入.算术速记?都?

编辑

感谢快速的快速回答.改变行以if ( (t = t / (d / 2)) < 1)获得jshint以停止烦恼.将添加答案为什么jshint/jslint选择抛出此错误.TL; DR:因为我发生了什么:"这是算法还是正则表达式?"

Poi*_*nty 6

那里的jsHint错了.那是

t /= d / 2
Run Code Online (Sandbox Code Playgroud)

意思是

t = t / (d / 2)
Run Code Online (Sandbox Code Playgroud)

请注意,括号在替代版本中很重要,因为通常/操作符从左到右绑定.该/=运营商的优先级比的/.

无论如何,整个事物的价值将是"t"的结果(更新)值.

现在,从更广泛的意义上说,jsHint 可能是正确的抱怨,但这是一个风格问题.运算符赋值运算符是一个相当古老的传统,至少可以追溯到C.