File tree Expand file tree Collapse file tree 1 file changed +12
-12
lines changed
1-js/02-first-steps/13-switch/1-rewrite-switch-if-else Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change 1
- To precisely match the functionality of ` switch ` , the ` if ` must use a strict comparison ` '===' ` .
1
+ Para que la funcionalidad de ` switch ` coincida precisamente, el ` if ` debe utilizar una comparación estricta ` '===' ` .
2
2
3
- For given strings though, a simple ` '==' ` works too .
3
+ Para strings, un simple ` '==' ` también funciona .
4
4
5
5
``` js no-beautify
6
- if (browser == ' Edge' ) {
7
- alert (" You've got the Edge!" );
8
- } else if (browser == ' Chrome'
9
- || browser == ' Firefox'
10
- || browser == ' Safari'
11
- || browser == ' Opera' ) {
12
- alert ( ' Okay we support these browsers too ' );
6
+ if (navegador == ' Edge' ) {
7
+ alert (" ¡Tienes Edge!" );
8
+ } else if (navegador == ' Chrome' )
9
+ || navegador == ' Firefox'
10
+ || navegador == ' Safari'
11
+ || navegador == ' Opera' ) {
12
+ alert ( ' Está bien, soportamos estos navegadores también ' );
13
13
} else {
14
- alert ( ' We hope that this page looks ok !' );
14
+ alert ( ' ¡Esperamos que la página se vea bien !' );
15
15
}
16
16
```
17
17
18
- Please note: the construct ` browser == 'Chrome' || browser == 'Firefox' …` is split into multiple lines for better readability .
18
+ Nota: El constructor ` navegador == 'Chrome' || navegador == 'Firefox' …` es separado en múltiples líneas para mejor lectura .
19
19
20
- But the ` switch ` construct is still cleaner and more descriptive .
20
+ Pero el constructor de ` switch ` sigue siendo más fácil de leer y más descriptivo .
You can’t perform that action at this time.
0 commit comments