File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
1-js/02-first-steps/13-switch/1-rewrite-switch-if-else Expand file tree Collapse file tree 1 file changed +7
-7
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+ Pentru a obține exact funcționalitatea instrucțiunii ` switch ` , ` if ` trebuie să folosească operatorul de egalitate exactă ` '===' ` .
22
3- For given strings though, a simple ` '==' ` works too .
3+ Pentru șirurile date, merge și egalitatea simplă ` '==' ` .
44
55``` js no-beautify
66if (browser == ' Edge' ) {
7- alert (" You've got the Edge!" );
7+ alert (" Folosiți Edge!" );
88} else if (browser == ' Chrome'
99 || browser == ' Firefox'
1010 || browser == ' Safari'
1111 || browser == ' Opera' ) {
12- alert ( ' Okay we support these browsers too ' );
12+ alert ( ' OK, suportăm și aceste browsere ' );
1313} else {
14- alert ( ' We hope that this page looks ok !' );
14+ alert ( ' Sperăm că această pagină arată bine !' );
1515}
1616```
1717
18- Please note: the construct ` browser == 'Chrome' || browser == 'Firefox' … ` is split into multiple lines for better readability .
18+ Observație: expresia ` browser == 'Chrome' || browser == 'Firefox' … ` este împărțită pe mai multe linii pentru a îmbunătăți lizibilitatea .
1919
20- But the ` switch ` construct is still cleaner and more descriptive .
20+ Totuși, construcția care folosește ` switch ` este mai curată și mai descriptivă .
You can’t perform that action at this time.
0 commit comments