Merge pull request #271 from Chaitanya-Raj/patch-1

fix typo
This commit is contained in:
Stepfen Shawn
2020-08-23 19:15:28 +08:00
committed by GitHub

View File

@ -1,6 +1,6 @@
function binaryToDeicmal (binaryNumber) { function binaryToDeicmal (binaryNumber) {
let decimalNumber = 0 let decimalNumber = 0
const binaryDigits = binaryNumber.split('').reverse() // Splits the bnary number in revered single digits const binaryDigits = binaryNumber.split('').reverse() // Splits the binary number into reversed single digits
binaryDigits.forEach((binaryDigit, index) => { binaryDigits.forEach((binaryDigit, index) => {
decimalNumber += binaryDigit * (Math.pow(2, index)) // Summation of all the decimal converted digits decimalNumber += binaryDigit * (Math.pow(2, index)) // Summation of all the decimal converted digits
}) })