Created
September 24, 2018 13:38
-
-
Save e-mihaylin/053f2bdc3e9ea017b8a491b2da080edd to your computer and use it in GitHub Desktop.
This file contains hidden or 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 gcd = (a, b) => a ? gcd(b % a, a) : b; | |
const lcm = (a, b) => a * b / gcd(a, b); | |
[1, 2, 3, 4, 5].reduce(lcm); // Returns 60 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment