Defining variables (#35891)
biString, uniString and i should be defined.
This commit is contained in:
committed by
The Coding Aviator
parent
7b51ec6487
commit
65a92f7ef9
@ -41,13 +41,13 @@ Make sure that each time you transcode a character from binary to decimal, you r
|
||||
##  Basic Code Solution:
|
||||
```javascript
|
||||
function binaryAgent(str) {
|
||||
biString = str.split(' ');
|
||||
uniString = [];
|
||||
var biString = str.split(' ');
|
||||
var uniString = [];
|
||||
|
||||
/*using the radix (or base) parameter in parseInt, we can convert the binary
|
||||
number to a decimal number while simultaneously converting to a char*/
|
||||
|
||||
for(i=0;i < biString.length;i++){
|
||||
for(var i=0;i < biString.length;i++){
|
||||
uniString.push(String.fromCharCode(parseInt(biString[i], 2)));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user