Thursday, 26 May 2011

Conditional Statements in JavaScript



Conditional Statements in JavaScript: If else by using this we can check the conditions and executes, some set of statements. If condition is true the statement followed by if will execute otherwise else blog statements will execute.
Sample Script :
<script>
x=100
y=100
if(x>y)
{
alert("x is Big")
}
else
{
alert("y is big")
}
</script>
Switch Case :
<script>
var x='P'
switch (x)
{
case 'a':
alert ('admin')
break;
case'p'
case 'P':
alert('Programes')
break;
default;
alert ("external")
}
</script>

0 comments:

Post a Comment