title: Find out number of numbers present in a comma separated string of numbers in Javascript
body: <p>I have a requirement to check if some given numbers are Pythogorean triplets.</p>
  
  <p>The textbox accepts string of numbers in the below format:</p>
  
  <p>3,4,5 (comma separated values)</p>
  
  <p>If the user enters more than or three numbers an error alert is displayed. My team mate figure out a way to do this , but accidentally. How does the below method work?</p>
  
  <pre><code>    function CheckNumbers(strnum){
       var num = strnum.split(",")
       if(num.length != 3)
        {
          alert(Enter exactly three numbers!)
          return;
  
        }
      }
  </code></pre>
  
  <p>Should'nt it return the length of the string rather than the number of numbers?</p>