mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-05-19 05:31:16 -05:00
Previously, if we wanted to test if A was either 'B' or 'C', we would use
the pattern:
A in {B:1, C:1}
I actually don't know how common this pattern is; I just started using
it because I was tired of typing `A === 'B' || A === 'C'` all the time.
I never really liked it, though; the `:1` part made it kind of
blatantly a hack.
I did some testing and `['B', 'C'].includes(A)` is overall faster.
(A switch statement is around 20x faster still, but who wants to type
that much code?)
Anyway, the new standard is
['B', 'C'].includes(A)
Something something progress!
|
||
|---|---|---|
| .. | ||
| abilities.js | ||
| aliases.js | ||
| bss-factory-sets.json | ||
| factory-sets.json | ||
| formats-data.js | ||
| items.js | ||
| learnsets.js | ||
| moves.js | ||
| pokedex.js | ||
| random-teams.js | ||
| rulesets.js | ||
| scripts.js | ||
| statuses.js | ||
| typechart.js | ||