> How to incorporate math and else if statements in javascript?

How to incorporate math and else if statements in javascript?

Posted at: 2014-12-18 
Like others have said, you can use conditional (if/else if/else) statements to redirect users to another webpage if the condition of the if/else if/else statement is equal to a certain value.

Depending on the language that you're using, the code to write the redirect may differ, but the general form of the conditional statements should look something like the code below.

if(result < 1){

//code here to redirect user to another webpage

}

else{

//result is not less than 1, so user is redirected to another webpage

}

If you were to have more than two pages to redirect users to, you could accomplish this redirection by including one or more "else if()" statements, depending on the number of webpages that your website redirects users to. In this case, you may want to use the "else" clause as a "default" case, as you could redirect users to a page that is not covered by the other if/else if clauses.

Best of luck and I hope I helped you!

Yea you can do that or you can do the ever so dreadful goto statement or you can do a switch statement or you can ignore the javascript and use php ( I am assuming this is for a website ) and use an associative array to your advantage.

If else is good enough.input = prompt("Choose a number") if (input<=1) { Do something} else {Do something else}

Of course you can also use forms with getElementById() ... I don't know exactly how you want to go about this, but it's fairly easy.

I currently am working to create a project that would take numbers entered by users and calculate them and then if the calculations come out to less than say 1 then it would redirect to one page but if its greater than it would direct to another page. can i use Else if statements or is there another way?