title: Splitting sentence into array of words
body: <p>folks, I'm trying to find out what <code>word</code> is the longest in an entered sentence but the code is not outputting anything. Could smb please help me with that? </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head lang = "en"&gt;
      &lt;meta charset = "UTF-8"&gt;
      &lt;title&gt;LongestWord&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;script language = "Javascript" type = "text/javascript"&gt;
      var sentence = prompt("Enter sentence: ");
      var splitted = sentence.split("\\s+");
      var longestWord = splitted[0];
  
      for(var i = 0; i &lt; splitted.length; i++){
          for(var j = 0; j &lt; splitted[i].length - 1; j++){
              if(longestWord.length &lt; splitted[i].length){
                  longestWord = splitted[i];
              }
  
          }
      }
      document.write("The longest word in the sentence is " + longestWord);  
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>