wha*_*gon 6 javascript operator-precedence
遇到这个JS片段,我真的不知道正在评估什么样的订单......有什么想法吗?括号会有帮助...
return point[0] >= -width / 2 - allowance &&
point[0] <= width / 2 + allowance &&
point[1] >= -height / 2 - allowance &&
point[1] <= height / 2 + allowance;
Run Code Online (Sandbox Code Playgroud)
相当于:
return
(point[0] >= ((-width / 2) - allowance))
&& (point[0] <= (( width / 2) + allowance))
&& (point[1] >= ((-height / 2) - allowance))
&& (point[1] <= (( height / 2) + allowance));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
471 次 |
| 最近记录: |