title: I am making a hangman game, i got the logic down but its not working,when i inspect it it says undefined touppercase
body: <p>AS you can see im making a simple hangman game with only html and javascript...ive got the logic down but it doesnt seem to work overall.I inspected the element to see whats wrong it says undefined toUppercase.</p>
  <p>Im a newbie programmer so do give me some pointer on how to fix this also pointer me in anything else that it wrong</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var keywords=["Apple","Banana","Variety"];
  var score=0, fails=0, actualword="", guessword;
      
  function startGame()
      {
          
          var num = Math.floor(keywords);
          actualword = keywords[num];
          actualword = actualword.toUpperCase();
          
          for ( i = 0; i &lt; actualword.length; i++)
      {
          guessword += "*";
      }
          document.getElementById("hangman").value = guessword;
          document.getElementById("msg").value = "A word has already been selected, click button below to play game.";
          document.getElementById("score").value = score;
          document.getElementById("fails").value = fails;
      }
      function find(x)
      {
          var found = false;
          for ( i =0; i &lt; actualword.length; i++)
              {
                  if(actualword.charAt(i) == x)
                      {
                          guessword = setCharAt(guessword, i, x);
                          found=true;
                      }
              }
          if(found)
              {
                  if( guessword == actualword)
                      {
                          alert("Well done!");
                          score++;
                          document.getElementById("msg").value = "Click 'Start' button to select the next keyword";
                          
                      }
              }
          document.getElementById("hangman").value = guessword;
          document.getElementById("score").value =  score;
          document.getElementById("fails").value = fails;
      }
      
      function setCharAt(str,index,chr)
      {
          return str.substr(0,index) + chr + str.substr(index+1);
      }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;HangMan Game - Javascript&lt;/title&gt;
  &lt;script&gt;
  &lt;/script&gt;  
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form name="f"&gt;
  
  &lt;table bgcolor="#C0C0C0" border="1"&gt;
   &lt;tbody&gt;&lt;tr&gt;
    &lt;td colspan="4" align="right"&gt;
     Score : &lt;input type="text" name="score" value="0" size="2"&gt;
     &lt;br&gt;
     Fails (6): &lt;input type="text" name="fails" value="0"size="2"&gt;  
    &lt;/td&gt;
    &lt;td colspan="7" align="CENTER"&gt;
     &lt;input type="text" name="hangman" value="    --- Hangman ---" size="25"&gt; 
      &lt;br&gt;
     &lt;input type="text" name="msg" value="Click GO to get a word." size="25"&gt;  
    &lt;/td&gt;
    &lt;td colspan="2" align="center"&gt;
     &lt;input type="button" onclick="startGame()" value=" START "&gt;   
    &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" A " onclick="find('A');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" B " onclick="find('B');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" C " onclick="find('C');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" D " onclick="find('D');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" E " onclick="find('E');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" F " onclick="find('F');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" G " onclick="find('G');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" H " onclick="find('H');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" I   " onclick="find('I');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" J  " onclick="find('J');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" K " onclick="find('K');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" L  " onclick="find('L');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" M " onclick="find('M');"&gt;&lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" N " onclick="find('N');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" O " onclick="find('O');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" P " onclick="find('P');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" Q " onclick="find('Q');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" R " onclick="find('R');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" S " onclick="find('S');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" T " onclick="find('T');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" U " onclick="find('U');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" V " onclick="find('V');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" W " onclick="find('W');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" X  " onclick="find('X');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" Y " onclick="find('Y');"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="BUTTON" value=" Z  " onclick="find('Z');"&gt;&lt;/td&gt;
   &lt;/tr&gt;
  &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>