Math.min() Math.max()
Math.min()取参数中最小的,Math.max()取参数中最大的
top=Math.min(top, topMax);
等价于
if(top>topMax)
{
top=topMax;
}
目标很遥远,但是如果你拼了命努力,即使到最后没有达到目标,但是你会发现,在某种程度上你已经成功了。
Math.min()取参数中最小的,Math.max()取参数中最大的
top=Math.min(top, topMax);
等价于
if(top>topMax)
{
top=topMax;
}