From 88dcf4a0085b946a1fcd4aa59a7c17b582de9846 Mon Sep 17 00:00:00 2001 From: Rohit Tanwar <31792358+kriadmin@users.noreply.github.com> Date: Fri, 29 Dec 2017 16:40:42 +0530 Subject: [PATCH] Update gcd.md --- snippets/gcd.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/gcd.md b/snippets/gcd.md index 4253e5fc3..251fc14ae 100644 --- a/snippets/gcd.md +++ b/snippets/gcd.md @@ -8,9 +8,9 @@ Otherwise, return the GCD of `y` and the remainder of the division `x/y`. ```js const gcm = (...arr) => { - arr = [].concat(...arr) +let data = [].concat(...arr) const helperGcd = (x, y) => (!y ? x : gcd(y, x % y)); -return arr.reduce((a, b) => helperGcd(a, b)) +return data.reduce((a, b) => helperGcd(a, b)) } ```