Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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'))
)
);
@cosmicbuffalo

This comment has been minimized.

Copy link
Owner Author

@cosmicbuffalo cosmicbuffalo commented May 24, 2017

This is an algorithm my instructor David at Coding Dojo showed me, and this was my first exposure to arrow functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment