Word to binary | codewars 7 kyu | Javascript

preview_player
Показать описание
Word to binary | codewars 7 kyu | Javascript

DESCRIPTION:
Write a function that takes a string and returns an array containing binary numbers equivalent to the ASCII codes of the characters of the string. The binary strings should be eight digits long.

Example: 'man' should return [ '01101101', '01100001', '01101110' ]
Рекомендации по теме
Комментарии
Автор

SHORT CODE SOLUTION BELOW :

function wordToBin(str){
let array = []
str.split('').forEach(char => {array.push(char.charCodeAt(0).toString(2).padStart(8, '0')) })
return array;
}

binarylife
welcome to shbcf.ru