Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
    var input = "H.E,L:;!?L()[o]{}";
    var str = input.toLowerCase().replace(/[.,:;!?(){}\[\]]+/g, '');
    var result;
    switch(str){    
        case "hi": result = "Hi there!";break;
        case "hello": result = "Hello,hello!";break;
        case "good morning": result = "Good morning, pal!";break;
        case "good evening": result = "Good evening, sir!";break;
        default:
        result = "I don't know what to say. Try to say 'hello' or 'hi'.";break;
    }
    console.log(result)
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers