条件演算子 Null合体演算子

inputData&&<div>inputData</div>
!inputData&&<div>notInputData</div>

&&の左側がtrueの時、&&の右側を実行する

||の左側がfalseの時、||の右側を実行する

const r01 = false;
const r02 = false;

if(r01||r02){
  console.log('ログを出力しました');
}
if(r01&&r02){
  console.log('ログを出力しました');
}



??の左側が null または undefined の場合に右の値を返し、それ以外の場合に左の値を返す。

const arr = ["abc","def",null];
const res = arr.filter(item => (item??'').indexOf("abc") !== -1);
console.log(res);  //  ['abc']