Hi all,
when writing in js I use a lot of nested if statements ...and I mean a LOT.
I will nest if statements in other if statements more than 20 times in a row.

People say that this is not normal but I don't know any other way.

Example
Sorry about this, giving an example feels kind of patronising (we all know what an if statement looks like) but if I don't give an example I know someone will ask for one, so here we go...

Lets pretend that I have a function that receives 'foo', a variable that could be any number from 1 to 100.
Receiving foo I now need to do 'something' that is specific to that number, this 'something' is not identical to the same thing that would need to be done for any other number.

The way I have been handling this so far is by nesting ifs like this...

Code:
if(foo<50)
{
if(foo<25) {
if(foo<12) {
if(foo<6) {
if(foo<3) {
if(foo==1) {
//run foo = 1
} else {
//run foo = 2
}
} else {
...etc...etc
}
} else {
...etc...etc
}
} else {
...etc...etc
}
} else {
...etc...etc
}
} else {
...etc...etc
}
Now if you imagine that all of the parts in the example that say ...etc...etc are actually continuing with the pattern you will start to understand my problem.

I know about the JavaScript Switch Statement but it's kind of the some thing, I think Switch Statements look even worse. Also using the else area that comes with the if statement is much more useful.

Is there a better solution?
Any feed back appreciated.