• + 0 comments

    optimal approach but first requesting other learner to understand the code first

    function findDigits(n) {
        // Write your code here
        let num = n
        let cnt = 0
        
        while(num > 0){
            const lastDigi = num % 10
            if(lastDigi !== 0 && (n % lastDigi === 0)){
                cnt++
            }
            num = Math.floor(num/10)
        }
        return cnt
    }