diff --git a/js/solution1.js b/js/solution1.js index 6943bc9..23f02bf 100644 --- a/js/solution1.js +++ b/js/solution1.js @@ -1,9 +1,8 @@ function tenToBin(x) { const l = []; - let i = x; - while (i !== 0) { - l.push(i % 2); - i = Math.trunc(i / 2); + while (x !== 0) { + l.push(x % 2); + x = Math.trunc(x / 2); } return l; }