title: Trying to find factors of a number in JS
body: <p>I am just starting JS, and understand the concept of finding a factor. However, this snippet of code is what I have so far. I have the str variable that outputs nothing but the first factor which is 2. I am trying to add each (int) to the str as a list of factors. What's the wrong in below code snippet?</p>
  
  <pre><code>function calculate(num) {
      var str = "";
      var int = 2;
      if (num % int == 0) {
          str = str + int;
          int++;
      } else {
          int++;
      }
      alert(str);
  }
  
  calculate(232);
  </code></pre>