If I have a loop with a condition inside like this, where I need an internal and an external variable:
let b = get(b);
for(let a in myArray){
if(a==b){
// Do something
}else{
// Do another thing
}
}
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.