aboutsummaryrefslogtreecommitdiff
path: root/challenge-088/richard-park/javascript/ch-1.js
blob: 362d5b1519b5056cdf82da18c895ca1f45dbc493 (plain)
1
2
3
4
5
// Inspired by {×/⍵⌷⍤1 99⍨↑(⊢~⍥,⍤99 0⊢)⍳⍴⍵}
RemoveFrom=(a,i)=>a.slice(0,i).concat(a.slice(i+1,))
I = n => [...Array(n).keys()]
P = a => a.reduce((x,y)=>x*y)
ArrayOfProduct=a=>I(a.length).map(i=>P(RemoveFrom(a,i)))