Q:

If and switch JS

I set few conditions on if/else but it only working on first condition, I used another way switch and found it completely worked, how do I fixed it?
for (let i = 1; i < 10; i++) {
  let contentall = document.getElementById(`content${i}`)
  contentall.addEventListener('click', (e) => {
        if (xhr.onreadystatechange = okgo) {
          let ibg3 = document.querySelectorAll('.ibg3 img')
          let text2 = document.querySelectorAll('.text2')
          let text4 = document.querySelectorAll('.text4')
          let ibg4 = document.querySelectorAll('.ibg4')
          let arr = [ibg3, ibg4, text2, text4]
          if (e.target !== text2[i - 1] || text4[i - 1] || ibg3[i - 1] || ibg4[i - 1]) {
            console.log("no match")
          } else {
            letgotall(i - 1)
            return
          }

          switch (e.target) {
            case ibg3[i - 1]:
              letgotall(i - 1)
              break;
            case text2[i - 1]:
              letgotall(i - 1)
              break;
            case text4[i - 1]:
              letgotall(i - 1)
              break;
            case ibg4[i - 1]:
              letgotall(i - 1)
              break;
            default:
              console.log("failure")
          }
        }

A:

Because your condition is wrong, right way is
if(e.target !== text2[i-1] || e.target !== text4[i-1])

or if you don want to repeat e.target you can use
if (!Set(text2[i-1], text4[i-1]).has(e.target)) console.log("Jesus Christ")

