Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function get_products_of_all_ints_except_at_index(list) {
- return list.map((_, i) => list.reduce((p, y, j) => i === j ? p : p * y, 1));
- }
- console.log(get_products_of_all_ints_except_at_index([1, 7, 3, 4])); // [84, 12, 28, 21]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement