Skip to content

Instantly share code, notes, and snippets.

@clive-bunting
Created December 4, 2015 21:08
Show Gist options
  • Select an option

  • Save clive-bunting/8dd43cf9ae357747ddc3 to your computer and use it in GitHub Desktop.

Select an option

Save clive-bunting/8dd43cf9ae357747ddc3 to your computer and use it in GitHub Desktop.
Bonfire: Binary Agents
// Bonfire: Binary Agents
// Author: @clive-bunting
// Challenge: http://www.freecodecamp.com/challenges/bonfire-binary-agents
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function binaryAgent(str) {
var numbers = str.split(' ');
var output = '';
for (var i = 0; i < numbers.length; i++) {
var charCode = parseInt(numbers[i], 2);
output = output.concat(String.fromCharCode(charCode));
}
return output;
}
binaryAgent("01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment