Good day!
There is a code:
OBJ = function(arr){ ON=true; function test(){ console.log(ON); } } OBJ.prototype = { start: function(){ ON = true; OBJ.test;//Доступ к функции test внутри OBJ!!!! }, stop: function(){ ON = false; } } This part of OBJ.test; does not work OBJ.test; .
Should run the test function from OBJ , but does not work. At least I think so.
What is wrong?
Update
A function that will work with a picture and create an animation, or rather move by pixels at a certain interval. The test function is responsible for the transition to other pixels (inside it there is a certain interval through which the transition will be made, it is recursive). The start and stop functions provide start and stop of such transitions. Start changes the On parameter to true and calls the test function, which will continue or begin moving through the image, by pixels. Stop will change the ON parameter to false , which will stop the robot of the recursive test function due to if(ON){test();} , which will stop the animation.