JavaScript Javascript code works different in different cases javascript code works with alert,javascript code only works in

My script doesn't works when I use requirejs library to launch it.

It's a simple game. After I click "start" program draws squares and when a green square appear the user has to click it as quick as possible. Then on the screen shows result how quick he did it.

Under this link script working properly: http://doomini2.linuxpl.info/correct/

When the script was loaded from normal js file everything was fine. But when it's loaded as a module then after the user click the green square in the "Last 5 results" box there's an extra result. The first time is the proper one (time between green square appears and user click) and the second time is the time which gone from moment when page loaded.

I don't have any idea why that second time appears and I don't know why it appears sometimes not every drawing.

This is the link to the version using "requirejs" library: http://doomini2.linuxpl.info/test/

I also tried to use "Event delegation", but it doesn't count the time from last "start" click but always from the first click after the page loaded.

This is the link to the version using "event delegation": http://doomini2.linuxpl.info/test2/

Why do the last two version not work? What causes the extra result?

Answer:1

I want to check if 1) a number is even or odd 2) print a message saying "not a number" if the value is not a number. I did with the if else statements but I'm trying to do it with the ternary one for ...

I want to check if 1) a number is even or odd 2) print a message saying "not a number" if the value is not a number. I did with the if else statements but I'm trying to do it with the ternary one for ...

I have a link button that goes to another page, it works, but i want the link to go to a spicific part of that page. i know i should use jquery for thisand for some reason its not jumping to the ...

I have a link button that goes to another page, it works, but i want the link to go to a spicific part of that page. i know i should use jquery for thisand for some reason its not jumping to the ...

  1. button link to part of page

I have the following Javascript string that represents a moment in time in Coordinated Universal Time (UTC): myUTCString = "2014-11-06 00:00:00"; I want to use moment.js to convert this string to a ...

I have the following Javascript string that represents a moment in time in Coordinated Universal Time (UTC): myUTCString = "2014-11-06 00:00:00"; I want to use moment.js to convert this string to a ...

  1. convert string into int
  2. convert string into array
  3. convert string into list
  4. convert string into json
  5. convert string into date
  6. convert string into array javascript
  7. convert string into integer
  8. convert string into int python
  9. convert string into datetime python
  10. convert string into int c++
  11. convert string into json object
  12. convert string into int java
  13. convert string into number javascript
  14. convert string into datetime
  15. convert string into float python
  16. convert string into dictionary python
  17. convert string into array python
  18. convert string into byte array
  19. convert string into double java
  20. convert string into json python

When I click on the button labeled "Continents & Oceans," a dropdown list appears - but only if I click on the button twice. I'd like it to work with the first click. Is there something wrong ...

When I click on the button labeled "Continents & Oceans," a dropdown list appears - but only if I click on the button twice. I'd like it to work with the first click. Is there something wrong ...