title: Javascript Case: "look at" + item
body: <p>Okay, so this may be a repeat, but I personally haven't seen anything on the internet or in Stackoverflow about this. </p>
  
  <p>I am working on a game project and I have been trying to make a text-based game. </p>
  
  <p>In this game, I have a switch statement, for when the user enters a command.</p>
  
  <p>So far I have things for Inventory and Look (Look around the environment), but how do I work with specific things in a switch statement?</p>
  
  <p>For example:</p>
  
  <pre><code>submit = function(input) {
      switch(input) {
          case "LOOK":
              lookaround();
              break;
          case "LOOK AT" + item:
              look();
      }
  }
  </code></pre>
  
  <p>It is the LOOK AT line I am having issues with. I do not know how I can make a string work in that format, unless I had a case for every single item individually, example case "LOOK AT ORANGE" or case "LOOK AT TREE".</p>
  
  <p>I hope I am explaining this thoroughly enough. Can anyone give me some advice?</p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I think it is important to note that the user is typing the input into an input box, so the value of the input is going to be a string. </p>
  
  <p>If it will help to see the code I have made, please let me know in the comments below. </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>THANKS FOR YOU HELP GUYS!</p>
  
  <p>I used a regular expression (Thanks @red-devil) and a mixture of slicing. It works perfectly now!</p>