Here's a project that simulates the "yield" keyword with current version of JavaScript: https://bitbucket.org/balpha/lyfe/wiki/Home
Generators like in Python allow for nice AI scripting with explicite time-sharing - each AI actor is generator function, that in main loop has yield statement.
That way it all works in one thread, and ai code can be written straightforward, like each actor had it's own thread.