Skip to content

Instantly share code, notes, and snippets.

@thexdev
Last active January 30, 2020 11:08
Show Gist options
  • Save thexdev/125518bc7fbb91d7315e77d41c5934bc to your computer and use it in GitHub Desktop.
Save thexdev/125518bc7fbb91d7315e77d41c5934bc to your computer and use it in GitHub Desktop.
JavaScript function to convert binary text to plain text
const binary2text = (binaryText = "") => {
return binaryText === ""
? binaryText
: binaryText
.split(" ")
.map(binary => parseInt(binary, 2))
.map(number => String.fromCharCode(number))
.join("");
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment