If...else Statement If you want to execute some code if a - TopicsExpress



          

If...else Statement If you want to execute some code if a condition is true and another code if the condition is not true, use the if....else statement. Syntax if (condition) { code to be executed if condition is true } else { code to be executed if condition is not true } Example //If the time is less than 10, //you will get a Good morning greeting. //Otherwise you will get a Good day greeting.var d = new Date(); var time = d.getHours(); if (time < 10) { document.write(Good morning!); } else { document.write(Good day!); }
Posted on: Wed, 16 Oct 2013 13:33:58 +0000

Trending Topics



Recently Viewed Topics




© 2015