Instructor David's arrow function for binary string expansion algorithm
const binaryStringExpansion = (str) => ( | |
(str.indexOf('_') === -1) ? | |
[str] : | |
binaryStringExpansion(str.replace('_', '0')) | |
.concat( | |
binaryStringExpansion(str.replace('_', '1')) | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
This is an algorithm my instructor David at Coding Dojo showed me, and this was my first exposure to arrow functions.