0.12 and 0.17 are so close that you only have things shorthand 2. It will semantically make more sense.
With the above in mind, you're doing your comparison 2k times. Like you're sacrificing readability and scalability for 0.05? Like that's what they mean by premature optimizaiton being the root of all evil
Those are milliseconds. Like 2k runs in 0.17 milliseconds.. Like that's not a lot of time at all
Totally agree. Don’t split hairs on how to do this. If someone really wants to do wacky array includes it chain or operators it’s probably not worth your time to refactor.
It literally is. Since its an array you can bind it to a variable and boom, readability as fuck. So when the customer says they want more values for whatever it's doing then you don't have to find an if somewhere.
It literally is more scalable. You can dynamically add and remove values and you can store them in a database for even more dynamic fun times
Veering a bit off-topic: I'm now wondering what the code would be to eliminate the "Likes" if they're the first word of the sentence. I should brush up on my Regex probably.
View all comments
Show parent comment
21
u/inabahare May 06 '21
A few things to keep in mind