var previousTime = 0, INTERVAL = 30, W = 800, H = 600, avatar, LEFT = 37, UP = 38, RIGHT = 39, DOWN = 40; window.onload = function() { var canvas = document.getElementById("canvas"), c = canvas.getContext("2d"); // 2x мерный поток console.log(c); avatar = new Avatar(); /*avatar.x = (W - avatar.size) / 2; avatar.y = (H - avatar.size) / 2;*/ setInterval(function() { var currentTime = new Date().getTime(), timeElapsed; if (previouseTime = 0) { previouseTime = currentTime; } timeElapsed = previouseTime - currentTime; update(timeElapsed, currentTime); draw(canvas, timeElapsed, currentTime); previouseTime = currentTime; }, INTERVAL); }; Good day. I understand the game written in the JS language. After the setInterval function, there is still code, but it is not important. does not concern my question in principle. The question is that the setInterval function starts every time after the INTERVAL time interval, processing the update and draw functions, even if we do not perform any actions in the game (for example, movement of a character in different directions)? That is, in fact, we have constantly working code? Thanks for the help in advance.