📜  将二进制转换为文本 js - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:26.629000             🧑  作者: Mango

代码示例1
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"