en.javascript.info/1-js/02-first-steps/13-switch/1-rewrite-switch-if-else/task.md
Ilya Kantor 19c782ff3d fix
2019-07-29 17:01:05 +03:00

427 B

importance: 5


Rewrite the "switch" into an "if"

Write the code using if..else which would correspond to the following switch:

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!' );
}