javascript – How to add a variable to a href tag as a parameter?

I have an interstitial page which has 6 identical links that depends on referralTokenValue to send traffic to a different site.

The link uses the following link structure:

<a href="https://example.com/program?referralToken=123456789">Link</a>

I’ve got a running prototype at: JSFiddle
However, I can’t use this prototype because it depends on the link ID attribute, which would not work 6 identical link IDs.

Because of this constraint, I’m looking for simple Javascript, without any dependencies on external CDN library(ies), where I can add the referralToken value to the Href tag, like so:

var referralTokenValue = 123456789;

I wanted to add the referraltokenValue to the href link tag, like so:

<a href="https://example.com/program?referralToken=referralTokenValue">Link</a>

The expected result would yield the following embedded link:

https://example.com/program?referralToken=12345789

How can add the referralTokenValue to the link without the dependency on the ID attribute?