I don't know how to achieve it and I been looking for ways to do this for hours without any success.

Let's say I have this code:

```
var vara="bing.com"; 
var varb="google.com"; 
jQuery('a[href^="http://'+vara+'"],a[href^="https://'+vara+'"]').click(function() {alert('y'); });
jQuery('a[href^="http://'+varb+'"],a[href^="https://'+varb+'"]').click(function() {alert('y'); });

```

And what I need to achieve here is to use one call that sets up the .click functions for each array variable:

```
var varall=["bing.com","google.com"];
jQuery('a[href^="http://'+varall+'"],a[href^="https://'+varall+'"]').click(function() {alert('y'); });

```

But this doesn't work. How to make variable "varall" take every element from array, so the second script would work as the first one?