Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次の省略形はありますか。
if ((items.length > 0) && ($item.length > 0)) { // Do Something... }
items以下は、と$itemsが配列であるという仮定の下にあります
items
$items
items.lengthどちらが当てはまるかを使用するだけです> 0
items.length
> 0
if (items.length && $items.length)
0 は false であるため、> 0 を削除して真の性質を使用できます。
if (items.length && $item.length) {