JavaScript Detect and combine N# of Arrays passed in to function?

I'm trying to figure out how to pass and combine an array when more than 1 is passed? The sample code below is the static version:
function insertStaticTags(){

        // Subroutine to remove tokens present in the static image src
        // and replace with actual data
        // - [RANDOMNUMBER]
        // - [URL]
        // - [NEWVSRETURNING]
        function detokenizeTags(imgSrc){
	         var rn = Math.random(),
            rnd = rn * 10000000000000;
            imgSrc = imgSrc.replace(/\[RANDOMNUMBER\]/g,rnd);
            imgSrc = imgSrc.replace(/\[URL\]/g,encodeURIComponent(location.href));
	         imgSrc = imgSrc.replace(/\[NEWVSRETURNING\]/g,_satellite.getVar("Customer Vs Anonymous"));
            return imgSrc; 
        // Array of marketing pixel tags src provided with tokens
        var sTags = [
        //routine to inject detokenized src values into container iframe
        var iframeTag = document.createElement("iframe");
        iframeTag.setAttribute("width", "1");
        iframeTag.setAttribute("height", "1"); = "none"; = "none";

        for(var i=0; i<sTags.length; i++) {
            var imgTag = document.createElement("img");
            imgTag.src = detokenizeTags(sTags[i]);

            // Invoke marketing tags

Open in new window

So In the above sample, the sTags array would need to be removed and passed in to the function but  I could possibly pass more than one array in (e.g. sTags2 and sTags3) to be processed at the same time if some condition dictates that. So I'll never know if I'm getting one or more arrays passed in. The naming of the arrays is up to me , if there is some way I can use that to my advantage?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jan LouwerensSoftware EngineerCommented:
Why not just have the function accept one array, but when calling the function, you could concatenate all of the desired arrays into one array.

For example:
insertStaticTags(sTags1.concat(sTags2, sTags3));

Open in new window

894359Author Commented:
I was thinking just use the arguments object/ array and then concatenate within the function?
Jan LouwerensSoftware EngineerCommented:
Yeah, that could work, too.

function insertStaticTags()
   var allSTags = [];
   for (var index = 0; index < arguments.length; index++)
      allSTags = allSTags.concat(arguments[index]);

Open in new window

var sTags1 = ['one', 'two', 'three'];
var sTags2 = ['four', 'five', 'six'];
var sTags3 = [];
var sTags4 = ['seven', 'eight'];

insertStaticTags(sTags1, sTags2, sTags3, sTags4);

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
894359Author Commented:
Thanks again Jan!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.