One-liner solution with ES6 syntax
function convertBinary(binary){
return binary.split(" ").map((x) => x = String.fromCharCode(parseInt(x, 2))).join("");
}
console.log(convertBinary("01001000 01100101 01101100 01101100 01101111 00100001"));
//This will print Hello!