1 Javascript - Conditional Statements Wed Mar 14, 2012 11:19 pm
Mr.Joker
Mr. WebArtz
Javascript - Conditional Statements If & Else and If Else Statements in JavaScript |
What is this tutorial about? Well, in javascript you can make some condition before something execute. For example if number 5 is larger then number 3 do this peace of code and so on. Here is how it look like:
Ok, we have statement that say, if x grater then y do this code. Lets check that. Variable x have value 2, and variable have value 4, so that statement isnt true. Dont do that. What now? Well there is else. Lets do that code if first isnt true , and thats it. But I want to show you some cool trick with boolean value.
Lets do some advanced thing now. There is else if add that can be used to make more conditions. Lets see example.
We have two conditions in start now. We say in brackets again if x larger then 7 or x larger then 3 do this code. So this || is translated on english OR. I say, if something, or if something do this. Another example:
Tutorial for WebArtz. |
Notice : This tutorial is copyrighted by WebArtz Forum. You may not publish it on anywhere without written permission from the administrators. |