title: Fix cyclomatic complexity if/else inside loop
body: <p>If I have a loop with a condition inside like this, where I need an internal and an external variable:</p>
  
  <pre><code>let b = get(b);
  
  for(let a in myArray){
     if(a==b){
       // Do something
     }else{
       // Do another thing
     }
  }
  </code></pre>
  
  <p>How can be the refector in order to reduce cyclomatic complexity.
  I've tried to extract the condition into another function, but I wonder if there is a best approach.</p>