Last active
January 30, 2020 11:08
-
-
Save thexdev/125518bc7fbb91d7315e77d41c5934bc to your computer and use it in GitHub Desktop.
JavaScript function to convert binary text to plain text
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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