1

Text to binary conversion

Function JavaScript 1 revisions 85 9 months ago 9 months ago
function textToBinary(text) {
	let binary = '';
	for (let ch in text)
		binary += ch.charCodeAt(0).toString(2)
	return binary;
}

This function converts any kind of a text (string) to its binary representation. (also string)

textToBinary('hello'); // "110000110001110010110011110100"