Delay in gameloop while pressing key

Trying to figure something to had a delay for my homemade animation.
So i have a little function that animate a container (rotation, pivot)
and i use to move it from the gameloop by pressing arrow key, the problem is the animation speed run way too fast
and if i use a sort of delay function like setTimeout it’s not working for the first time pressing and i can’t basically put
a cycle starter on top cause it’s would play 2x instead of 1. Any idea ?

let step = 0, keyboard = [];

function rotate(){
 switch(step){
     case 0: 
        //first rotation
     break;
     case 1:
        //next rotation 
     break;
     //then add more rotation if you want 
  }
}

function gameLoop(){
 if(keyboard["ArrowLeft"] || keyboard["ArrowRight"])
    // here i need something like delay of 1s for each rotate();
}

window.addEventListener("keydown", event => {
  if(["ArrowLeft", "ArrowRight"].indexOf(event.key) != -1)
    keyboard[event.key] = true;
});
window.addEventListener("keyup", event => {
  if(["ArrowLeft", "ArrowRight"].indexOf(event.key) != -1)
      keyboard[event.key] = false;
});