• + 0 comments
      var  poistion_array = []
    
    var poistion_dic = {}
    
    var poistion = 1
    for (var i = 0; i < ranked.length ; i++){
    
        if ( poistion_dic[ranked[i]] == undefined){
    
            poistion_dic[ranked[i]] = poistion
            poistion++
    
        }
    
    }
    
    var previous_index =  ranked.length - 1
    for (var i = 0; i < player.length; i++){
    
        var flag = true
        
    
        for (var j  = previous_index ; j >=0; j--){
              previous_index  = j
            if(player[i] < ranked[j]){
    
                 poistion_array.push(poistion_dic[ranked[j]] +1)
                 j = -1
                 flag = false
    
            }
    
    
            if(player[i] == ranked[j]){
    
                poistion_array.push(poistion_dic[ranked[j]])
                j = -1
                flag = false
    
            }
            
            
        previous_index 
    
    
    
        }
        if (flag ){
    
            poistion_array.push(1)
    
        }
    }
    console.log(poistion_array)
    return poistion_array
    }