Has Anki changed the way it processes javascript?

I recently changed PCs and have gone from a version of Anki that was maybe 3 years old to the latest one.

I don’t have access to the old PC now but I have the hard drive.

I moved the files over but the javascript on my cards is no longer working.

It looks like there may be a problem with:

The array name “exno”
Statements like MyVar = String.raw{{MyField}}

When I removed all instances of these two things the rest of the code worked again. Can anyone tell me why? I need to fix those bits and put them back in.

Also, if there was a problem with the JS I used to get some kind of indication in the right hand pane, but now it looks like the code just doesn’t run. Is this a difference between the old and new versions or is there a setting somewhere I need to change?

It’s hard to tell what’s the issue without seeing the code. Sharing your template will make it easier for others to help. You can use export a sample card and upload it to some site like https://gofile.io/

1 Like

Thanks for replying. I don’t think there’s a problem with either of the things I mentioned. It looks like it didn’t used to matter if you used let or const outside a block (did the whole script then count as the block?), but now it does. I just deleted them and now it works.

I still don’t know why I just get a preview of whatever code does work now (in the right hand pane, I mean) rather than the error message you used to get.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.