0

Here's the current code I'm using:

var domainArray = ['google.com', 'yahoo.com', 'bing.com'];
var rand_domain = domainArray[Math.floor(Math.random() * domainArray.length)];
window.location = "http://${rand_domain}/subfolder";

I want this to randomly redirect to one of these links:

http://google.com/subfolder
http://yahoo.com/subfolder
http://bing.com/subfolder

But instead, it's just redirecting here:

http://${rand_domain}/subfolder

What am I doing wrong?

Chase
  • 115
  • 2
  • 8

0 Answers0