Skip to content

Decode a Binary Message

Posted in Education, and WhoCodeFirst

We are going to see how to decode a binary message using JavaScript.

A message that was in binary format :

01010100 01101000 01100001 01110100 00100111 01110011 00100000 01110011 01101111 00100000 01100011 01101111 01101111 01101100

Solution:

var mes = "01010100 01101000 01100001 01110100 00100111 01110011 00100000 01110011 01101111 00100000 01100011 01101111 01101111 01101100";
var res = mes.split(' ')
             .map(x=>parseInt(x,2))
             .map(num=>String.fromCharCode(num))
             .join('')

console.log(res);

Result:

That’s so cool

I hope you enjoyed this little tutorial!

Happy Coding! 😇

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Exit mobile version