[英]What does '/=' operator mean in JavaScript?
I came across this looking at the source for some physics animations in JavaScript found here on github where he's written this 我在github上找到了一些物理动画的源代码,我在这里写了这篇文章
if (this._position < 0) this._position /= 3;
A quick Google yielded nothing, anyone know? 一个快速的谷歌什么都没有,任何人都知道?
The operator is shorthand division operator . 操作员是速记分部操作员 。 It is equivalent to
它相当于
this.position = this.position / 3;
The division will be performed first and then the result will be assigned to the dividend. 将首先执行除法,然后将结果分配给被除数。
The division assignment operator divides a variable by the value of the right operand and assigns the result to the variable.
除法赋值运算符将变量除以右操作数的值,并将结果赋给变量。
它是等于+=
或-=
的除法
This is a division asignment operator: This performs the following operation: Ex: 这是一个除法运算符:它执行以下操作:Ex:
var x=10,y=2;
x=x/y;
/*
which is equivalent to x/=y;
and returns 5
*/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.