使用 location 的 search 方法查询地址并解析字符串,返回一个对象

//使用location.search查询解析字符串,然后返回包含所有参数的一个对象
function getQueryStringArgs(){
    //取得查询字符串并去掉开头的问号
    var qs = (location.search.length > 0) ? location.search.substring(1) : "",
    //保存数据的对象
    args = {},
    //取得每一项
    items = qs.length ? qs.split("&") : [],
    item = null,
    name = null,
    value = null,
    //在for循环中使用
    i = 0,
    len = items.length;
    //逐个将每一项添加到args对象中
    for(i=0; i<len; i++){
        item = items[i].split("=");
        name = decodeURIComponent(item[0]);
        value = decodeURIComponent(item[1]);
        if(name.length){
            args[name] = value;
        }
    }
    return args;
}

由于一开始写成了args.name=value,但是这样就相当于把name作为一个字符串了,而不是name实际代表的值,所以要使用args[name]的方式。请问这里大家都是这样处理的吗?