shuffle_list.js 1.66 KB
function shuffle(x){
    if(x.name === "kia"){
        for(j = 0; j < kia_hitter_shuffle.length; j++){
            if(kia_hitter_shuffle.length == 0){
                continue;
            }
            else if(x.value == kia_hitter_shuffle[j][0]){
                console.log(x.value == kia_hitter_shuffle[j][0])
                return 0;
            }
        }
        for(i = 0; i < kia_hitter.length; i++){
            if(x.value == kia_hitter[i][0]){
                kia_hitter_shuffle.push(kia_hitter[i]);
            }
        }
    }
    console.log(kia_hitter_shuffle);
    ////////////////////////////////////////////////////////////////
    if(x.name === "dusan"){
        for(j = 0; j < dusan_hitter_shuffle.length; j++){
            if(dusan_hitter_shuffle.length == 0){
                continue;
            }
            else if(x.value == dusan_hitter_shuffle[j][0]){
                console.log(x.value == dusan_hitter_shuffle[j][0])
                return 0;
            }
        }
        for(i = 0; i < dusan_hitter.length; i++){
            if(x.value == dusan_hitter[i][0]){
                dusan_hitter_shuffle.push(dusan_hitter[i]);
            }
        }
    }
    //나머지 팀들 똑같이 추가
}

function remove(x){
    if(document.getElementById(x.name).name == 'kia'){
        for(i = 0; i < kia_hitter_shuffle.length; i++){
            if(kia_hitter_shuffle.length == 0){
                return 0;
            }
            else if(document.getElementById(x.name).value == kia_hitter_shuffle[i][0]){
                kia_hitter_shuffle.splice(i,1);
            }
        }
    }
    console.log(kia_hitter_shuffle);
    //나머지 팀들 똑같이 추가
}