// Text to Binary function text2Binary(string) { return string.split('').map(function (char) { return char.charCodeAt(0).toString(2); }).join(' '); } text2Binary("Hello World");