The workflow is quite simple - the execute child node is executed first as the parent, so it tells the null to activate and receive the number from the condition. When the condition de-activates, the execute child deactivates first so the null doesn’t update to pick up the extractor position, therefore, the value is held.
The accumulator here just picks up the value in from the conidition, and just loops between 0-1 depending on the condition. converting to 3 could be done a number of ways, either multiply after the fact or set the max value to 6.
Finally, as you found, Javascript is a totally viable solution here too. Personally I wouldn’t because of the above two options, but I dont see any issue with js here either.