UNPKG

convert2base

Version:

Project developed to perform basic binary conversions involving binary, octal, decimal and hexadecimal numbers.

12 lines (11 loc) 474 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.convertDecimalToBinaryRecursive = void 0; const convertDecimalToBinaryRecursive = (decimalNumber) => { if (decimalNumber === 0) { return ''; } const remainder = decimalNumber % 2; return (0, exports.convertDecimalToBinaryRecursive)(Math.floor(decimalNumber / 2)) + remainder.toString(); }; exports.convertDecimalToBinaryRecursive = convertDecimalToBinaryRecursive;