async and await Javascript operators are not recognised in the Javascript editor

Gene1313Gene1313 Community Member Qubie ✭

async and await Javascript operators are not recognised in the Javascript editor

Hi,

I will be using Javascript code in a Qualtrics question to run a Javascript game of Tetris. I have put this code in the Javascript editor however it appears that the Javascript operators async and await are not able to be recognised in the Qualtrics Javascript editor. It says "Invalid JavaScript! You cannot save until you fix all errors: Unexpected token function." However, when I remove async and await from the Javascript code there is no problem and the code is able to be saved so there appears to be something with async and await that isn't recognised by Qualtrics?

Could you please advise me on what to do? It would be really great if I could get this up and running as the async and await operators are essential for what I want to do with the code.

Thank you for your help!

Answers

  • Annie2538Annie2538 Community Member Qubie ✭
    edited December 2020

    I encountered the same problem last week. If I am not mistaken, async functions are relatively new to Javascript, which might be the reason why they can't be implemented in Qualtrics yet. (I also found somewhere else that in the offline world, Node.js only supports async await in v7 and higher.)

    Maybe there are compatibility issues with different browsers? I'm still quite new to JS, so I'm very curious.

    Maybe someone with more background knowledge can shed some light on this?

  • Gene1313Gene1313 Community Member Qubie ✭

    Yes that's what I was thinking too. Looks like it could be a compatibility issue.


    Would be great if someone with an understanding of this could let us know!

Sign In to Comment