Driver code
let n = 5 ; let array = [ 10 , 3 , 5 , 6 , 2 ] ; let ans = Array ( n ) . fill ( 0 ) ; ans = productExceptSelf ( array , n ) ; for ( let i = 0 ; i < n ; i ++ ) { document . write ( ans [ i ] + " " ) ; }