Should this code work? I get a JS error
What's the JS error? Usually that should never happen so should always be filed as a bug.
No, all is well. My fault. But what about this?
drive.google.com/file/d/1bv5mAXtbKeRJS-3q2qeX4mgD9hWAEXTH/view
cap
Develop games in your browser. Powerful, performant & highly capable.
JavaScript errors are always Construct's fault and should be reported.
In the second example, after a 'Wait' the function has ended so the local variable no longer exists. So it has no value.