Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: Why my regex doesn't work

  1. #11
    Join Date
    Nov 2014
    Location
    On A Scottish Island
    Posts
    488
    Thanks
    0
    Thanked 62 Times in 58 Posts

    Default

    This is much clearer and is easily extended to cover other replies:

    Code:
    var answer = window.prompt('Type YES, NO, or MAYBE.  Then click OK.').toUpperCase();
    switch (answer) {
      case "YES":
        console.log("You said YES!");
        break;
      case "NO":
        console.log("You said NO!");
        break;
      case "MAYBE":
        console.log("You said MAYBE!");
        break;
      default:
        console.log("You rebel, you!");
    };

  2. The Following User Says Thank You to styxlawyer For This Useful Post:

    bautistajuan071 (05-24-2016)

  3. #12
    Join Date
    May 2015
    Posts
    18
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    I like it thanks

Similar Threads

  1. Why Doesn't it Work?
    By ??? in forum JavaScript
    Replies: 3
    Last Post: 08-11-2007, 01:32 AM
  2. Why doesn't this work??
    By shachi in forum JavaScript
    Replies: 8
    Last Post: 01-06-2007, 03:07 PM
  3. Why doesn't this work??
    By morleymc in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 10-03-2005, 04:19 AM
  4. regex problem. passing dynamica var in regex
    By s_sameer in forum JavaScript
    Replies: 4
    Last Post: 09-18-2005, 05:01 PM
  5. Top nav II bar doesn't work!!
    By Blackryder in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 04-26-2005, 06:48 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •