I'm studing a solution of this lesson:
https://app.codility.com/programmers/lessons/4-counting_elements/perm_check/
I headed up of this solution made my a github user. https://github.com/daraosn/codility/tree/master/02-CountingElements/02-PermCheck/javascript
I did understand everything of the code below:
function solution(A) {
        var N = A.length;
        var sum = (N * (N+1)) / 2;
        var tap = [];
        for (var i in A) {
            sum-=A[i];
            if(tap[A[i]]) {
                return 0;
            }
            tap[A[i]] = true;
        }
        return +(sum==0);
    }
with exception of these code lines below:
if(tap[A[i]]) {
  return 0;
}
tap[A[i]] = true;
What is its purppose? I didn't understand. I did a test deleting these code lines from the answer in the codility interface and it returned 75% right instead of 100% when I had these lines
 
     
     
    