Hacker News new | past | comments | ask | show | jobs | submit login

I see the logic of this feature, and in a couple of seconds I'll be unable to understand it again.



I keep wanting the else to run when the loop didn't iterate.


I thought about how I'd do this in JS, and it's paradoxically more compact and less confusing without dedicated syntax:

  if (leaders.some(i => i == "Yang")) {
      alert("Yang is a leader!");
  } else {
      alert("Not found Yang!");
  }




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: