"else if" statement within for loop within larger if/else if/else statement
<p>Is it possible to do something like this in JavaScript?</p>

<pre><code>if (name == 'foo') {
    exampleFunction('some_arg');
}
else if (name == 'bar') {
    exampleFunction('another_arg');
}
for (i in exampleObject) {
    else if (name == exampleObject[i].name) {
        exampleFunction(exampleObject[i].arg);
    }
}
else {
    exampleFunction('default')
}
</code></pre>

<p>I tried it, but got an "unexpected keyword else on line 8" (the "else if" within the for loop). Is there another way to do this? </p>

<p>edit: updated this to use exampleObject[i] in the loop. My bad!</p>
