How:Write scripts in JavaScript for Memento: Difference between revisions

Jump to navigation Jump to search
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 :.


== Trigger script ==
 
== Shared script ==


TBD
TBD


== Action script ==
== Trigger script ==


TBD
TBD


== Shared script ==
== Action script ==


TBD
TBD