2005-01-04

JScript

JScript has no direct way of creating Variant arrays (aka SafeArrays or VBArrays).  However, here is a hack to create one:

function makeVBArray(elements)
{
    var dictionary = new ActiveXObject("Scripting.Dictionary");
    for (var i = 0; i < elements.length; ++i) {
        dictionary.add(elements[i], "");
    }
    return dictionary.Keys();
}