Created
December 5, 2019 16:37
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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