I’m still very much a beginner so don’t really understand how this might be done.
I need a client to be able to add there own url to some code but wanted to separate it, so they can paste it at the top of the code so its clear for them to see. Then reference the variable in the link.
None of those sorts of changes can be done with JavaScript. I suggest that you investigate using a server-side script, such as PHP, to perform the task instead.