Do you really need to if for non 0 length before foreach?
Seriously. For each knows the container is empty.
Dammit! lol you're right
Is preemptive code, supposing future changes, a bad practice?
What changes would that be? It's not very likely that forEach would change
In this case? Definitely. It needlessly introduces an additional if statement that increases complexity
This is why I don’t trust Math.random() - it knows too much...
Wtf, having type as a string and not enum...
Could be like a string literal union in typescript, but still
Do you really need to if for non 0 length before foreach?
Seriously. For each knows the container is empty.
Dammit! lol you're right
Is preemptive code, supposing future changes, a bad practice?
What changes would that be? It's not very likely that forEach would change
In this case? Definitely. It needlessly introduces an additional if statement that increases complexity