-
-
Notifications
You must be signed in to change notification settings - Fork 3
The "switch" statement #80
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
Merged
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
3618c1e
1.2.14
otmon76 689f6ef
Update article.md
otmon76 46e7da1
Update 1-js/02-first-steps/14-switch/article.md
otmon76 8267ffd
Update 1-js/02-first-steps/14-switch/article.md
otmon76 be04a15
Update 1-js/02-first-steps/14-switch/article.md
otmon76 b43a7f7
Update 1-js/02-first-steps/14-switch/article.md
otmon76 0175f60
Update 1-js/02-first-steps/14-switch/article.md
otmon76 f296504
Update 1-js/02-first-steps/14-switch/2-rewrite-if-switch/solution.md
otmon76 a00b6ea
Update 1-js/02-first-steps/14-switch/2-rewrite-if-switch/solution.md
otmon76 83c716b
Update 1-js/02-first-steps/14-switch/1-rewrite-switch-if-else/task.md
otmon76 ec21520
Update 1-js/02-first-steps/14-switch/1-rewrite-switch-if-else/solutio…
otmon76 ade3e94
Update 1-js/02-first-steps/14-switch/1-rewrite-switch-if-else/solutio…
otmon76 0118abc
Update 1-js/02-first-steps/14-switch/article.md
otmon76 df55831
Update 1-js/02-first-steps/14-switch/article.md
otmon76 8b0a009
Update 1-js/02-first-steps/14-switch/article.md
otmon76 f2e8640
Update 1-js/02-first-steps/14-switch/article.md
otmon76 76ffe78
Update 1-js/02-first-steps/14-switch/article.md
otmon76 a8d1eef
Update 1-js/02-first-steps/14-switch/article.md
otmon76 bf79758
Update 1-js/02-first-steps/14-switch/article.md
otmon76 17b7cf7
Update 1-js/02-first-steps/14-switch/article.md
otmon76 8ee22f1
Merge branch 'master' into 1.2.14
otmon76 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
24 changes: 12 additions & 12 deletions
24
1-js/02-first-steps/14-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 `'==='`. | ||
Abychom dosáhli přesné funkcionality příkazu `switch`, musí `if` používat striktní rovnost `'==='`. | ||
|
||
For given strings though, a simple `'=='` works too. | ||
V tomto případě však pro zadané řetězce funguje i obyčejné `'=='`. | ||
|
||
```js no-beautify | ||
if(browser == 'Edge') { | ||
alert("You've got the Edge!"); | ||
} else if (browser == 'Chrome' | ||
|| browser == 'Firefox' | ||
|| browser == 'Safari' | ||
|| browser == 'Opera') { | ||
alert( 'Okay we support these browsers too' ); | ||
if(prohlížeč == 'Edge') { | ||
alert("Vy máte Edge!"); | ||
} else if (prohlížeč == 'Chrome' | ||
|| prohlížeč == 'Firefox' | ||
|| prohlížeč == 'Safari' | ||
|| prohlížeč == 'Opera') { | ||
alert( 'Dobrá, tyto prohlížeče také podporujeme' ); | ||
} else { | ||
alert( 'We hope that this page looks ok!' ); | ||
alert( 'Doufáme, že tato stránka vypadá dobře!' ); | ||
} | ||
``` | ||
|
||
Please note: the construct `browser == 'Chrome' || browser == 'Firefox' …` is split into multiple lines for better readability. | ||
Všimněte si, že konstrukce `prohlížeč == 'Chrome' || prohlížeč == 'Firefox' …` je pro lepší čitelnost rozdělena do několika řádků. | ||
|
||
But the `switch` construct is still cleaner and more descriptive. | ||
I tak je ovšem konstrukce `switch` jasnější a přehlednější. | ||
otmon76 marked this conversation as resolved.
Show resolved
Hide resolved
|
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
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.