10
You need to break your function at that point, and add another function to catch the user's button press event.
You can use Narrative Javascript to introduce blocking behavior and simplify it (so you don't need to break up your function into two part), but note that this library has been abandoned since 2013.
I wouldn't play with timeouts and intervals for that.
You'd be better off cutting the program in 2 parts, may be as you suggest in 2 functions.
Run the first part, add the code to ask the user for action.
And then based on the action, run the second part.