if...else if...else





js/script.js
  • var val = 10;
  •  
  • function funMake() {
  •  if(val < 10) {
  •   document.write('Hello World!' + '<br />');
  •  }
  •  else if(val > 10) {
  •   document.write('Привет Мир!' + '<br />');
  •  }
  •  else {
  •   document.write('To be or not to be?' + '<br />');
  •  }
  • }
var val = 10;

function funMake() {
 if(val < 10) {
  document.write('Hello World!' + '
'); } else if(val > 10) { document.write('Привет Мир!' + '
'); } else { document.write('To be or not to be?' + '
'); } }


index.html
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <script src="js/script.js"></script>
  • </head>
  • <body>
  • <script>
  •  funMake();
  • </script>
  • </body>
  • </html>
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <script src="js/script.js"></script>
  • </head>
  • <body>
  • <script>
  •  funMake();
  • </script>
  • </body>
  • </html>