Skip to content

Instantly share code, notes, and snippets.

@Gfast2
Created December 5, 2019 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gfast2/541617bf2b25c9daca5e1163a1a0f200 to your computer and use it in GitHub Desktop.
Save Gfast2/541617bf2b25c9daca5e1163a1a0f200 to your computer and use it in GitHub Desktop.
A small quick answer I found in the most elegant way to solve the problem.
'use strict';
const main = () => {
const par1 = [3, 'smart'];
const par2 = [5, 'clip'];
const parser = (index, arr) => index % arr[0] === 0 ? arr[1] : '';
for (let i = 1; i <= 100; i++) {
const st = parser(i, par1);
const cp = parser(i, par2);
console.log(`${i} -> ${st}${cp}`);
}
};
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment