출처 : 본인

출처2 : http://ejohn.org/blog/javascript-array-remove/

출처3 : https://fimtrus.tistory.com/entry/Javacript-Array-remove-Index-%EB%B0%B0%EC%97%B4-%EC%82%AD%EC%A0%9C



Array.prototype.remove = function() {
    var whata = argumentsL = a.lengthax;
    while (L && this.length) {
        what = a[--L];
        while ((ax = this.indexOf(what)) !== -1) {
            this.splice(ax1);
        }
    }
    return this;
};

Array.prototype.removeIndex = function () {
    var a = argumentslength = a.length;
    this.splice ( a[--length], 1 );
    return this;
}




 

 

//배열 요소 추가

function GetCCls_Result(data) {

    var xmlData = $.parseXML(data);

    var Table = $("Table", xmlData);

    Table.each(function () {

        var ClsGrpCD = $("ClsGrpCD", $(this)).text();

        var ClsCD = $("ClsCD", $(this)).text();

        var Name = $("Name", $(this)).text();

 

        clsCD.push({

            ClsGrpCD: ClsGrpCD,

            ClsCD: ClsCD,

            Name: Name

        });

    });

}

 

//배열 요소 사용

function GetClsCD_Client(ClsGrpCD) {

    $("#selClsCD option:gt(0)").remove();

    for (var i = 0; i < clsCD.length ; i++) {

        if (clsCD[i].ClsGrpCD == ClsGrpCD) {

            $("#selClsCD").append("<option value=" + clsCD[i].ClsCD + ">" + clsCD[i].Name + "</option>");

        }

    }

}

 

//배열 요소 삭제

Array.prototype.remove = function (from, to) {

    var rest = this.slice((to || from) + 1 || this.length);

    this.length = from < 0 ? this.length + from : from;

    return this.push.apply(this, rest);

};

Posted by motolies
,