Latest News

Ternary Conditional Statement In Javascript,Ternary Conditional Statement


Ternary conditional statement: It is also known as single line conditional statement.
Syntax: (condition)?true statement:false statement;
Example:
document.write(“ternary”);
var x=20;
(x<20 && x>=20)?document.write(“true”):document.write(“false);
NOTE: when condition is true after the question mark statement will execute and when condition false after the colon(:) statement will execute.

No comments:

Post a Comment

eWeb Classes Powered by MV Innovative InfoTech Copyright © 2014

Theme images by Bim. Powered by Blogger.