Let's say we have this kind of code:
var movement = setInterval(function() {
var position = 0; // Just some example values
var limit = 200; // to go with the code below
if (position < limit) {
position = position + 10;
}
}, 500);
Is it possible to replace the <
sign in position < limit
and the +
sign in position + 10
with a variable (so that the code works of course) ?
And if it is, what's the best way to do it ?