Tuesday, March 23, 2010

JavaScript IIF

A control statement (IIF) in JavaScript. A very simple terminology reference that might be used in a day to day programming paradigm.

Syntax

(CONDITION)?'OUTPUT_WHEN_SATISFIED':'OUTPUT_WHEN_NOT_SATISFIED';

Sample Snippet

    var sResult;
    sResult=(1==2)?'No':'Yes';
    alert(sResult);

Output: Yes will be displayed as a message.

Tags: JavaScript, JavaScriptIIF,JavaScript IIF, JavaScript iif, iif