981377660LMT / ts

ts学习
6 stars 1 forks source link

js 布尔值压行技巧:if 中使用三元表达式 #438

Open 981377660LMT opened 7 months ago

981377660LMT commented 7 months ago

if 里可以使用三元表达式

while (pos > 0) {
  const candId = this._lineIds[pos]
  if (candId !== -1 && candId !== resLineId) {
    const candValue = this._evaluateInner(candId, x)
    if (this._minimize ? candValue < resValue : candValue > resValue) {
      resValue = candValue
      resLineId = candId
    }
  }
  pos >>>= 1
}