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
ok
ReplyDeleteWhere did you get the IIF from? It's already well known as Conditional Operator (?:) (AKA: Ternary Operator)
ReplyDeletehttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator i.e:
(boolean) ? (if-true-do-this) : (else-do-that) ;
@Roko, agreed that this is a ternary operator in JavaScript, had used the term for a better understanding and comparison with iif in ColdFusion
ReplyDeleteThanks for sharing this quality information with us. I really enjoyed reading. Will surely going to share this URL with my friends.
ReplyDeleteWebdesign