Last active
October 4, 2019 00:04
-
-
Save marclundgren/349ba33b1002fab510a0b29ca8df1c2f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sum = ((a, b) => a + b) | |
const triangleNumber = (number) => { | |
const list = [] | |
list.length = number | |
list.fill() | |
return list.map((_, index) => index + 1).reduce(sum, 0) | |
} |
Author
marclundgren
commented
Oct 4, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment