param { number [ ] } nums return { number [ ] } var productExceptSelf = function ( nums ) : number [ ] { let output = new Array ( nums . length ) ; let cur = 1 ; for ( let i = 0 ; i < nums . length ; i ++ ) { output [ i ] = cur ; cur = cur * nums [ i ] ; } cur = 1 ; for ( let i = nums . length - 1 ; i >= 0 ; i -- ) { output [ i ] = output [ i ] * cur ; cur = nums [ i ] * cur ; } return output ; } ; export { productExceptSelf } ;