javascript convert binary to text

function binaryAgent(str) {

var newBin = str.split(" ");
var binCode = [];

for (i = 0; i < newBin.length; i++) {
    binCode.push(String.fromCharCode(parseInt(newBin[i], 2)));
  }
return binCode.join("");
}
binaryAgent('01000001 01110010 01100101 01101110 00100111 01110100');
//translates to "Aren't"

0
0
StuartQ 85 points

                                    function binaryAgent(str) {
  let bytes = str.split(' ');
  let output = '';
    
  for (let k = 0; k &lt; bytes.length; k++){
      output += String.fromCharCode(convertToDecimal(bytes[k]));
  }

  return output;
}

function convertToDecimal(byte) {
  let result = 0;

  byte = byte.split('');

  byte.reverse();

  for (let a = 0; a &lt; byte.length; a++){
    if (byte[a] === '1'){
      result += 2 ** a;
    }
  }

  return result;
}

binaryAgent(&quot;01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111&quot;);

0
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
nodejs binary to string convert binary to text js w3 convert binary to text js transform a binary code to text javascript binary number to string javascript binary string to text javascript binary to text function javascript how to convert text to binary in js javascript binary to character binary data to string javascript javascript binary to text convert binary to word js text to binary js javascript binary from string how to translate binary to letters javascript convert text to binary js toString binary to text javascript function binary to text javascript javascript read binary to english javascript turn binary into string convert binary string to char javascript binary to english js binary to character javascript convert binary to text in javascript how to binary to string javascript javascript from binary to english javascript translate binary to text convert binary data to string javascript string to binary javascript convert binary number to text in javascript? js convert binary string to string binary code convert to text javascript binary to text js converting binary to string javascript js binary to character js convert binary character to string js convert binary to string javascript translate binary to string js bin to string javascript binary to string js binary string to text binary to string js convert binary to text javascript js converting binary to text turns into computer code javascript binary code translator how to convert binary string to string in javascript convert binary to string js js binary to letters 8 bit binary to text in javascript how to convert binary to text in javascript javascript convert binary string to string javascript convert binary to string binary to string javascript convert binary to string javascript convert binary to string javasctip binary to ascii function in typescript js binary to string from binary to text javascript javascript convert binary to text
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source