I've recently started going through some of Codility coding tests and so far I'am getting 0% on my code performace almost every time.
This one https://codility.com/programmers/lessons/6-sorting/distinct/ is very simple code of finding number of distinct integers in an array.
My code is syntactically correct and works properly but what can i do to optimize the performance ?
This is my code:
function solution(A) {
    var res = []
    var len = A.length
    for(var i=len;i--;){
        if(!res.includes(A[i])){
            res.push(A[i])
            }
        }
        return res.length
}

 
     
    