How to have multiple URLs in a let URL in JavaScript

I have the following statement in my frontend JavaScript

let totalURL = "http://total.40313993.qpc.hal.davecutting.uk";

I would like to add another URL to this, if the first one fails then use this URL. I have no idea how i would implement this in JavaScript any and all help is very welcome and appreciated.