Skip to content

Instantly share code, notes, and snippets.

@whynotavailable
Last active November 1, 2021 03:57
Show Gist options
  • Save whynotavailable/2a7a8af3e928e9931cb0233fe5924729 to your computer and use it in GitHub Desktop.
Save whynotavailable/2a7a8af3e928e9931cb0233fe5924729 to your computer and use it in GitHub Desktop.
example.js
class Example {
flip(text) {
return [...text].reduce((previousValue, currentValue) => currentValue + previousValue, '');
}
run(text) {
return this.flip(padLeft(text))
function padLeft() {
return '000' + text;
}
}
}
const example = new Example();
console.log(example.run('abc'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment