Execute JavaScript code and replace the code with the result
You can execute any JavaScript code by first selecting it and then running Eval and Replace: JS from the command palette (or by selecting it and using the default keybinding, Ctrl + Shift + J)
You can evaluate multiple expressions selected seperately, and each will be replaced seperately, however: the same context is used for all selections, so you can reuse variables.
Additionally you have access to these pre-initialized global functions and variables:
i,j,n,x,y,z: initialized with0a,s: initialized with''PI: Alias forMath.PI(etc. for otherMathproperties & methods)randomInt(min: number, max: number): generates a random integer betweenminandmax(inclusive of both)
Note that you can add your own custom pre-initialized data through the eval-and-replace.preinitializedScript setting.
If you have any questions / concerns about this extension, reach out to me on Discord at lebster
Enjoy!
