en.javascript.info/1-js/02-first-steps/14-switch/1-rewrite-switch-if-else/task.md

26 lines
427 B
Markdown

importance: 5
---
# Rewrite the "switch" into an "if"
Write the code using `if..else` which would correspond to the following `switch`:
```js
switch (browser) {
case 'Edge':
alert( "You've got the Edge!" );
break;
case 'Chrome':
case 'Firefox':
case 'Safari':
case 'Opera':
alert( 'Okay we support these browsers too' );
break;
default:
alert( 'We hope that this page looks ok!' );
}
```