this is what i did
my game loop is run every REFRESH milliseconds
loop = setInterval(tick,REFRESH);
in the loop i calculate how much time is passed since last tick and subdivide that for how much time i expected to be passed
var now = performance.now();
var elapsedTime = now - lastTick;
var delta = time / REFRESH;
lastTick = now;
and every time based action that should happen every tick is "scaled" with the delta factor, for example my movement code
var distance=ball.dest.x-ball.x;
var movement=distance/speed;
ball.x+=movement;
will have movement multiplied with delta