Lonely Integer

  • + 0 comments

    I wanna recieve feedback about my Javascript solution, thxs!:

    function lonelyinteger(a) {
        // Write your code here
        a.sort((a, b) => a - b);
        let aux=0
        for(let i=0;i<a.length;i++){
            if(a[i]!=a[i+1]) aux=a[i]
            else i++
        }
        return aux;
    
    }