The "switch" statement by bmatasar · Pull Request #9 · javascript-tutorial/ro.javascript.info

@bmatasar

lighthousand


*!*
case 3: // (*) grouped two cases
case 3: // (*) douș cazuri grupate

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo : "douș"
Possible fix : "două"

Acum atât `3` cât și `5` arată același mesaj.

The ability to "group" cases is a side-effect of how `switch/case` works without `break`. Here the execution of `case 3` starts from the line `(*)` and goes through `case 5`, because there's no `break`.
Posibilitatea de a ȚgrupaȚ cazuri este un efect secundar al modului în care funcționează `switch/case` fără `break`. Execuția blocului `case 3` începe de la linia marcată `(*)` și continuă în `case 5`, pentru că nu există niciun `break`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo : "...de a ȚgrupaȚ..."

Possible fix : '...de a"grupa"...'

@@ -1,20 +1,20 @@
To precisely match the functionality of `switch`, the `if` must use a strict comparison `'==='`.
Pentru a obține exact funcționalitatea instrucțiunii `switch`, `if` trebuie să folosească operatorul de egalitate exactă `'==='`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technical typo : "...egalitate exactă"

Possible fix : "...egalitate strictă"

Observație: instrucțiunea `break` de la sfârșit nu este necesară, dar putem să o adăugăm pentru a pregăti codul pentru viitor.

In the future, there is a chance that we'd want to add one more `case`, for example `case 4`. And if we forget to add a break before it, at the end of `case 3`, there will be an error. So that's a kind of self-insurance.
În viitor este posibil că vom dori să mai adăugăm încă un `case`, de exemplu `case 4`. Dacă uităm să adăugăm un `break` înaintea lui, la sfârșitul blocului `case 3`, vom obține o eroare. Deci avem un fel de auto-asigurare.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional suggestion for grammar :

if can be done transform this : "...este posibil că vom dori...."

into this : "...este posibil să dorim...."
"...este posibil să vrem...."

@javascript-translate-bot

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻

@bmatasar