-
Notifications
You must be signed in to change notification settings - Fork 31
The "switch" statement #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lighthousand
merged 9 commits into
javascript-tutorial:master
from
bmatasar:bmatasar-switch
Jun 4, 2019
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d3bea6b
Translated
bmatasar 59c6193
Update task.md
bmatasar 3b3b39a
Update solution.md
bmatasar 6a6904a
Update task.md
bmatasar 69f821e
Update solution.md
bmatasar 60b4d9f
Update article.md
bmatasar befc1da
Update article.md
bmatasar d9fb0fa
Update solution.md
bmatasar 2c6a43a
Update solution.md
bmatasar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
14 changes: 7 additions & 7 deletions
14
1-js/02-first-steps/13-switch/1-rewrite-switch-if-else/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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ă `'==='`. | ||
|
|
||
| For given strings though, a simple `'=='` works too. | ||
| Pentru șirurile date, merge și egalitatea simplă `'=='`. | ||
|
|
||
| ```js no-beautify | ||
| if(browser == 'Edge') { | ||
| alert("You've got the Edge!"); | ||
| alert("Folosiți Edge!"); | ||
| } else if (browser == 'Chrome' | ||
| || browser == 'Firefox' | ||
| || browser == 'Safari' | ||
| || browser == 'Opera') { | ||
| alert( 'Okay we support these browsers too' ); | ||
| alert( 'OK, suportăm și aceste browsere' ); | ||
| } else { | ||
| alert( 'We hope that this page looks ok!' ); | ||
| alert( 'Sperăm că această pagină arată bine!' ); | ||
| } | ||
| ``` | ||
|
|
||
| Please note: the construct `browser == 'Chrome' || browser == 'Firefox' …` is split into multiple lines for better readability. | ||
| Observație: expresia `browser == 'Chrome' || browser == 'Firefox' …` este împărțită pe mai multe linii pentru a îmbunătăți lizibilitatea. | ||
|
|
||
| But the `switch` construct is still cleaner and more descriptive. | ||
| Totuși, construcția care folosește `switch` este mai curată și mai descriptivă. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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ă"