Skip to content

Commit d29f7be

Browse files
committed
MATH: Binary to octal
1 parent b3be6ac commit d29f7be

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Maths/convertBinaryToOctal.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const binaryToDecimal = (input) => {
2+
return parseInt(input.toString(), 2);
3+
};
4+
5+
export const binaryToOctal = (input) => {
6+
const decimal = binaryToDecimal(input);
7+
return Number(decimal.toString(8));
8+
};

0 commit comments

Comments
 (0)