Write, Bureaucrats, Administrators
4,332
edits
mNo edit summary |
mNo edit summary |
||
Line 62: | Line 62: | ||
:: in canDrive = age > 16 ? 'yes' : 'no', ? and : are used like if and else together as the only ''ternary'' operator in JavaScript — the ''conditional'' operator. The > is a binary operator that returns ''true'' or ''false''. If the result is true (the age is over 16), then canDrive will be true. If it is false, canDrive will be false. It is good for cases where something is this or else that — one or the other, plain & simple. Since it is plain & simple, it is (perhaps) appropriate to simplify the conditional as well, with ? and :. | :: in canDrive = age > 16 ? 'yes' : 'no', ? and : are used like if and else together as the only ''ternary'' operator in JavaScript — the ''conditional'' operator. The > is a binary operator that returns ''true'' or ''false''. If the result is true (the age is over 16), then canDrive will be true. If it is false, canDrive will be false. It is good for cases where something is this or else that — one or the other, plain & simple. Since it is plain & simple, it is (perhaps) appropriate to simplify the conditional as well, with ? and :. | ||
== | |||
== Shared script == | |||
TBD | TBD | ||
== | == Trigger script == | ||
TBD | TBD | ||
== | == Action script == | ||
TBD | TBD |