my previous question about this dealt with global vars
but unfortunatley the window of opportunitys doesn't work with this next example because it alerts 4 times instead of only 1

test("a","b","c");
function test(var0,var1,var2,var3) {
    for(var i=0; i<4; i++) {
        if(window["var"+i]===undefined) {alert("test");}
    }
}

this may not be very clear so I will try again
this time I want it to alert all three vars

test("a","b","c");
function test(var0,var1,var2) {
    for(var i=0; i<3; i++) {
        alert(window["var"+i]);
    }
}

how can I achieve the identical results as with the window["str"+var] from within a function?

All of the values passed to a function are stored in "arguments".

test("a","b","c");
function test(var0,var1,var2) {
    for(var i=0; i<3; i++) {
        alert(arguments[i]);
    }
}
commented: thanks :) +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.