Code:
if (conda) {
...
} else {
...
}
... can be other conditional blocks.
Code:
if (conda) {
if (condb) {
if (condc) {
...
} else if (condd) {
...
} else {
...
}
} else {
...
}
} else {
....
}
Or, maybe:
Code:
function b (condc) {
if (condc) {
...
} else if (condd) { // condd is global
...
} else {
...
}
}
function a (condb) {
if (condb) {
b (condc) // condc is global
} else {
...
}
}
if (conda) {
a (condb) // condb is global
} else {
....
}
All the same pretty much goes for loops, though replacing loops with functions, when the language directly supports loops, is probably the wrong thing to do.
However out there this sounds, do yourself a favor and learn Scheme. You are having some very fundamental issues, based on this thread and the last. In neither thread have you had problems with anything specifically Javascript-related, though it has been a vehicle. Either use online resources (
example), or
the book (
link--notice cheaper used copies), find an interpreter, and spend some spare time learning it. I guarantee you that as you do so, you see the Javascript you are learning through new eyes (you will also understand why people make and use more complicated languages, after about your millionth closing parenthesis

).
Since it looks you're just beginning to learn programming in general,
even better. Nesting, conditional blocks, loops, nested loops, function returns (the thread from last month), and so on, are basic features/problems of most practical programming languages. While not nearly at the level of Java, C#, or C++, Javascript is a fairly complicated and feature-packed language, and that in itself could very well be getting in your way. LISP, though Scheme especially, is about as far from that as you can get (one could describe the whole language on an index card...with a jumbo sharpie!).
Also, to get your
actual question, most in-depth Javascript articles will be over your head, because the stuff you are looking for is generally considered basic programming knowledge. So, introductions will generally assume you know nothing, and try not to get too complicated, or they'll assume you know it already, and get on with the more intricate work. I'm sure there are some in between out there, but it's probably not worth the time to try to find them.
There are a lot of other things you could do, but I'll be willing to bet that trying to learn a LISP will lead you to several epiphanies within the first few days about things you've been having trouble understanding trying to learn in Javascript (such as function/expression composition and decomposition, which is a common theme between both threads you've made thus far). Starting off learning Javascript would not be unlike going from basic arithmetic to linear algebra, without the scalar algebra in between.