Write, Bureaucrats, Administrators

4,043

edits

Jump to navigation
Jump to search
##
How:Write scripts in JavaScript for Memento
(view source)

###
Revision as of 06:20, 9 May 2021

21 bytes added
, 06:20, 9 May 2021
m

no edit summary

Line 60:
Line 60:

:: in x++, ++ is a ''unary'' operator.

:: in x++, ++ is a ''unary'' operator.

:: in b - 5, - is a ''binary'' operator.

:: in b - 5, - is a ''binary'' operator.

−:: in canDrive = age > 16 ? 'yes' : 'no', ? and : are used like if and else together as ~~a ~~''ternary'' operator — 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 ==

== Trigger script ==