+ 4
{solved}Plz I need help with my code.
I passed the variable "rotateDeg" in the argument of setRotationInterval, then I incremented by 1 every .008seconds from 0 in the setInterval. But when I click a button to run the function for the box to rotate, the "rotateDeg" variable does not increment. How can I get past this problem? It rotates when I press the buttons multiple times but I want the box to rotate itself when I press any button once. https://code.sololearn.com/W9Jlx9HJqYL5/?ref=app
6 odpowiedzi
+ 4
JaScript Thanks very much.
Though I've gotten it.
I used another method.
+ 4
Cool. One thing only, it would be interesting, if you could click second time the same button to stop the rotation. Do you like this challenge to code?
+ 4
Thank you for your suggestion. I love it. I appreciate it. I'll implement it soon.
Well, I think I like some challenging codes.
+ 3
let rotation;
let rotateDeg = 0;
variables should be global.
+ 3
No problem, your welcome.