I could have used the TwineScript logical OR (or) operator there as well, probably should have (since some people have issues remembering which sigil-style operators are which). Force of habit caused me to use the JavaScript logical OR (||) operator.
In TwineScript you may use either logical OR operator, its own (or) or JavaScript's (||), since TwineScript is just a candy coating over JavaScript.
In JavaScript you may only use its logical OR operator (||).
So, which parts are TwineScript and which JavaScript in SugarCube?
The contents of the <<script>> macro and script sections (i.e. Story JavaScript in Twine 2 and script tagged passages in Twine 1) are evaluated as pure JavaScript. All other script-y bits are evaluated as TwineScript.
If TwineScript is just a candy coating over JavaScript, what does it add and/or change?
TwineScript adds wordy operators (e.g. to and is; see <<if>> and <<set>> for more information) and handling of story variables (e.g. $foo).
Comments
In JavaScript you may only use its logical OR operator (||).
So, which parts are TwineScript and which JavaScript in SugarCube?
The contents of the <<script>> macro and script sections (i.e. Story JavaScript in Twine 2 and script tagged passages in Twine 1) are evaluated as pure JavaScript. All other script-y bits are evaluated as TwineScript.
If TwineScript is just a candy coating over JavaScript, what does it add and/or change?
TwineScript adds wordy operators (e.g. to and is; see <<if>> and <<set>> for more information) and handling of story variables (e.g. $foo).
So, about JavaScript….
See: MDN JavaScript Guide & MDN JavaScript Reference.