# Two questions: (1) steps for generating the online version of my task (2) JS code

**URL:** https://discourse.psychopy.org/t/two-questions-1-steps-for-generating-the-online-version-of-my-task-2-js-code/7973
**Category:** Online experiments
**Created:** [May 31, 2019, 2:24pm UTC](https://discourse.psychopy.org/t/two-questions-1-steps-for-generating-the-online-version-of-my-task-2-js-code/7973 "2019-05-31T14:24:13Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![dvbridges](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/dvbridges/32/1918_2.png) [@dvbridges](https://discourse.psychopy.org/u/dvbridges)
#### Post date: [June 3, 2019, 2:00pm UTC](https://discourse.psychopy.org/t/two-questions-1-steps-for-generating-the-online-version-of-my-task-2-js-code/7973/2 "2019-06-03T14:00:03Z")

</div>

Hi @M11, if the code is not being output correctly, it means there is some issue stopping the code from being compiled. The translations above would be made easier if you surround your code in backticks (```). Try:

```javascript
msg = '';
if (mouse.getPressed()[0] === 1) { // If left mouse button pressed 
  clickable = [R, F]; // clickable stim
  for (const obj of clickable) { // for each clickable stim, check if it contains the mouse
    if (obj.contains(mouse)) {
      if (obj === R && R === eval(MathCorr) ) {
         msg = "Correct";
         psychoJS.experiment.addData('MathScore', R === eval(MathCorr));
      } else if (obj === F && F === eval(MathCorr) ) {
        msg = "Wrong. Click buttons more exactly";
        psychoJS.experiment.addData('MathScore', F === eval(MathCorr));
      }
    }
  }
}
        

```

---

_[View the full topic](https://discourse.psychopy.org/t/two-questions-1-steps-for-generating-the-online-version-of-my-task-2-js-code/7973)._
