js lang solution №1 update

This commit is contained in:
Дмитрий Голондарев 2026-03-28 20:55:51 +03:00
parent 2a3ed164a3
commit 2feb7c18e9

View file

@ -1,9 +1,8 @@
function tenToBin(x) { function tenToBin(x) {
const l = []; const l = [];
let i = x; while (x !== 0) {
while (i !== 0) { l.push(x % 2);
l.push(i % 2); x = Math.trunc(x / 2);
i = Math.trunc(i / 2);
} }
return l; return l;
} }