Skip to content

Instantly share code, notes, and snippets.

Created February 20, 2015 06:09
function BiSequence(binaries){
this.BI_STR_LEN = 8;
this.binaries = binaries;
}
BiSequence.prototype.toString = function(binaries){
var msg = "";
var result = 0;
for(var i = 0; i < this.binaries.length; i++){
for(var j = 0; j < this.BI_STR_LEN; j++){
result = result * 2 + parseInt(this.binaries[i][[j]]);
}
msg += String.fromCharCode(result);
result = 0;
}
return msg;
}
function Main(){
input = prompt("What is your number: ");
var regex = /(0|1){8}/g
var sequence = new BiSequence(input.match(regex));
confirm(sequence.toString());
}
Main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment