Count divisors of array multiplication | To count number of factors in a number ; Initialize count with 0 ; Increment count for every factor of the given number X . ; Return number of factors ; Returns number of divisors in array multiplication ; Multipliying all elements of the given array . ; Calling function which count number of factors of the number ; driver function
function counDivisors ( X ) { let count = 0 ; for ( let i = 1 ; i <= X ; ++ i ) { if ( X % i == 0 ) { count ++ ; } } return count ; } function countDivisorsMult ( arr , n ) { let mul = 1 ; for ( let i = 0 ; i < n ; ++ i ) mul *= arr [ i ] ; return counDivisors ( mul ) ; } let arr = [ 2 , 4 , 6 ] ; let n = arr . length ; document . write ( countDivisorsMult ( arr , n ) ) ;