Forum Discussion

JeanMarrapodi-c's avatar
JeanMarrapodi-c
Community Member
3 months ago
Solved

JavaScript API

DavidAnderson​ challenged us to play with JavaScript API today, so here I am stuck with a javascript item I can't get to work. The attached project has two slides. I used Javascript on the first slid...
  • Nathan_Hilliard's avatar
    Nathan_Hilliard
    2 months ago

    For your stated issue, you need to change the value in the third trigger on layer q5 to "Q5" instead of "q5" for Set currentQuestion. That fixes the key response.

    Unrelated, but you are also missing a T/F SL variable "Q4Correct". 

    Another note is that in the second trigger JavaScript,  for case 'Q5' you could change event.code to event.key just to be consistent with the other keypress checks. It doesn't change anything as the code and key for Pause are the same, but it makes the code clearer.