Best Alternative to using import in JS

I use a few import statements in my experiments, mainly for time and random. This is causing some issues when trying to run my experiment online.

Is there a simpler way around this than just manually having to alter the code?

Kind regards,

Rob

I write my Python code so it doesn’t rely on importing libraries. Then the auto-created JS code usually works first time.

Hi Wakefield,

I wished I had done that now! Would the best approach be to write a function to replace my imported libraries?

Kind regards,

Rob

You need to look at each function separately. Some may just need the removal of random. (e.g random.shuffle can be replaced with shuffle)

You might find my crib sheet and code snippets helpful.

Hi Wakefield,

Thank you! I’ll probably get some help in convert the code as I am pretty poor at programming in general, but I’ll probably create some further studies to improve on my current one in the future, so once I’ve got it running online, I’ll check between the offline and online versions to get a better understanding between Python and the JS requirements.

Kind regards,

Rob