const getText = i => {
if (i % 3 === 0 && i % 5 === 0) {
return 'fizzbuzz';
}
if (i % 3 === 0) {
return 'fizz';
}
if (i % 5 === 0) {
return 'buzz';
}
return i;
}
And call this from your iterating code, and print that out,
there's a concept of cognitive load, if you have else on your code, your brain needs to track what's going on, and it'll lead to a very nested sloppy code,
try getting rid of else, keep edgecase on if and happy path on a straight line, your code will be readable. (line of sight)
And don't do this:
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
don't ever use else,
And call this from your iterating code, and print that out,
there's a concept of cognitive load, if you have else on your code, your brain needs to track what's going on, and it'll lead to a very nested sloppy code,
try getting rid of else, keep edgecase on if and happy path on a straight line, your code will be readable. (line of sight)
And don't do this: