Thanks for the advice on the Developing Forum.
The JS is used on 2 pages/posts.
It is a child theme.
My coding experience level is pretty low (basic HTML), but I am working with an experienced coder who is new to WP. He has informed me that he found a WP plugin called ‘Per page add to head’, and it seems work well for our needs here.
Thanks!