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 responses = { 
        hi: "Hi there!",
        hello: "Hello,hello!",
        "good morning": "Good morning, pal!",
        "good evening": "Good evening, sir!"
    };
    var default_response = "I don't know what to say. Try to say 'hello' or 'hi'.";
    var input = "H.E,L:;!?L()[o]{}";
    var key = input.toLowerCase().replace(/[.,:;!?(){}\[\]]+/g, '');
    var result = key in responses ? responses[key] : default_response;
    
    console.log(result);
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers