Ya there are definitely shorter solutions I've seen a couple of one liners most aren't very readable and confuse a lot of devs lol I generally lean more towards readability and this was more to teach newer devs how to break down problems to find their solutions but this is definitely a good solution as well :)
Nice solution!
if (num % 5 === 0 && num % 3 === 0)
can be simplified asif (num % 15 === 0)
Here's a one-liner using ternary operation.
How about a shorter one liner?
Still using the ternary operators, but using a bit of magic as well.
answer re: 1, 2, Fizz, 4, Buzz
JavaScript, 62 bytes
I think I this is the shortest Javascript solution now.
Ya there are definitely shorter solutions I've seen a couple of one liners most aren't very readable and confuse a lot of devs lol I generally lean more towards readability and this was more to teach newer devs how to break down problems to find their solutions but this is definitely a good solution as well :)
Agreed, which is why I initially posted this comment!
While it is possible to make the code very short, your solution is a lot more legible and maintainable than these one liners.