router.goBack() several times in one jump

Can anyone explain me a correct way for router.goBack() for several steps in one jump?

I have a history list of my path through the pages. When user tap some entry in this list, router should navigate to this page. I made a for loop and repeat router.goBack() several times. All works just fine, but may be there is a better way?

Thanks in advance!

Why don’t you use router.goto("page") instead? You can go to the intended page wherever you are!