← Back to challenges

Transforming Words into Binary Strings

JavaScriptHardstringsregex

Instructions

Write a function that transforms all letters from [a, m] to 0 and letters from [n, z] to 1 in a string.

Examples

convertBinary("house") ➞ "01110"

convertBinary("excLAIM") ➞ "0100000"

convertBinary("moon") ➞ "0111"

Notes

Conversion should be case insensitive (see example #2).

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Numbers to Arrays and Vice Versa