Skip to content

Commit 3587d57

Browse files
author
Kyle Maune
committed
added solution for binary converter
1 parent 6c33842 commit 3587d57

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Medium Difficulty/binaryConverter.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// coderbyte solution for binary converter
2+
// splashinn
3+
4+
function BinaryConverter(str){
5+
result = 0;
6+
for (var i = str.length -1; i >= 0; i--){
7+
result += str[i] * Math.pow(2,str.length - 1 - i)
8+
}
9+
return result;
10+
}

0 commit comments

Comments
 (0)