+ 1
Please solve my JavaScript problem
Please solve this (JavaScript) I want to make classes all with their own x varibles and their own Intervals to change them, but I am having a problem. When I write " this.x" it cannot find a varible. How can I get this varible? (Below prints NaN and I know the functions are working properly) function example(x) { this.x=x this.rightStart= function() { this.mover= setInterval( function() { this.x+=1 console.log(this.x) }, 10) } this.rightEnd= function() { clearInterval(this.mover); } }
2 Answers
+ 1
This will help you:
https://code.sololearn.com/WlwkC73NA68V/?ref=app
0
Thank yous



