Loop Prev and Next Buttons

I am trying to utilize this article https://support.wix.com/en/article/velo-tutorial-creating-previous-and-next-buttons-for-a-dynamic-item-page-with-code
for building buttons to traverse through my dynamic page items however I am getting an error on the index page’s code, the item page is fine:

Your error message blocks when you set the value of dynamicPageURLs, could you do another screenshot where you show what the full code is?

I got the code to work, it doesn’t loop but the buttons work local . setItem ( ‘dynamicPageURLs’ , dynamicPageURLs . join ( “,” )); fixed the error
I did find an article on looping but still wasnt able to ( https://www.wixfix.com/post/loop-dynamic-buttons)