|
|
|
|
|
by borishn
1897 days ago
|
|
The article is misleading, in implying that `switch(true)` is a special case: "The fundamental principle of the switch true pattern is that you can match against expressions as well as values." It should be states as "The fundamental principle of the switch pattern in JavaScript is that you can match against expressions as well as values." From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...: A switch statement first evaluates its expression. It then looks for the first case clause whose expression evaluates to the same value as the result of the input expression |
|