I have a simple a tag in html that when clicked I want to link to a random address picked from an array of possible links.
So in the code here I have an array of the links and I'm picking a random number from the length of that array, I'm then using that number to pick a random link from the array.
var links_arr = ["http://www.link1.com","http://www.link2.com","http://www.link3.com","http://www.link4.com"]
var ranNum = Math.floor(Math.random()*links_arr.length)
var linkTo = links_arr[ranNum];
This all works fine and the window.alert show randomly picked links from the array.
The problem is passing the link to the href of the a tag - how can I use the link in the href ?