Answers for "how to write a function that computes the gcd of 2 positive integers in javascript"

8

javascript gcd

const gcd = (a, b) => b === 0 ? a : gcd(b, a % b);

// Example
gcd(10, 15);    // 5
Posted by: Guest on July-03-2020

Code answers related to "how to write a function that computes the gcd of 2 positive integers in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language