Beginner JavaScript Tutorial – 18 – switch




Facebook – https://www.facebook.com/TheNewBoston-464114846956315/
GitHub – https://github.com/buckyroberts
Google+ – https://plus.google.com/+BuckyRoberts
LinkedIn – https://www.linkedin.com/in/buckyroberts
reddit – https://www.reddit.com/r/thenewboston/
Support – https://www.patreon.com/thenewboston
thenewboston – https://thenewboston.com/
Twitter – https://twitter.com/bucky_roberts

Original source


41 responses to “Beginner JavaScript Tutorial – 18 – switch”

  1. Enjoy!!!

    <!DOCTYPE html>
    <html lang="en">
    <head>
     <meta charset="UTF-8">
     <title>Document</title><script>
       function the(){
        var x1 = document.getElementById("apple");
         var a = "Hello";
        switch(apple.value = a ){
                    case "Hello":
                    alert("nice");
                    function helo(){
                    for(x = 0; x < 10; x++){
                   document.write("nice job<br />");
                    }
                }setTimeout(helo, 1000);
                    break;
        }
    }  
    </script>
      <style type="text/css">  </style>
    </head>
    <body> 
         <input type="text" id="apple" placeholder="Type Hello">
         <input type="Submit" onclick="the()">
         </body>
    </html>

  2. Dude you are so thorough! I love your teaching style and Im learning from you way easier than when I was in college! It's more fun too. Thanks for making these and for being yourself while teaching

  3. How to get the user's input in js Sir like java.util.Scanner; in Java? I know its out from Switch Statement topic but it just suddenly remind me after watching this tutorial. Thank you from Philippines.

  4. <script type="text/javascript">
    // This is a practice javascript & XHTML file

    var name = ""Your name here"";
    var saySomething = "Hello"

    function fdsa(x){

    switch(x){
    case "Hey":
    document.write("Hello " + name);
    break;
    case "Hi":
    document.write("Hey " + name);
    break;
    case "Hello":
    document.write("How's it going " + name + "?");
    break;
    case "What's up?":
    document.write("Just doing computer stuff…");
    break;
    }
    return " ";
    }

    document.write(name + ": " + saySomething + "<br/>");
    document.write("Computer: ");
    document.write(fdsa(saySomething));

    </script>

    put your name in the first variable(name) and say hi or hello in the second variable(saySomething)

Leave a Reply