title: Codefights: Given an integer n, return the largest number that contains exactly n digits
body: <p>So I have to find the largest number that contains n digits. For example, if n=2, then the largestNumber = 99. This was my answer.</p>
  
  <pre><code>function largestNumber(n) {
      var num = [];
      n = num.length;
      for(var i = 0; i &lt; n; i++){
          num[i] = "9";
      };
      var large = +(num.join(''));
      return large;
  }
  </code></pre>
  
  <p>Unfortunately, it returned "0". When I tried to console.log the array.</p>
  
  <pre><code>function largestNumber(n) {
      var num = [];
      n = num.length;
      for(var i = 0; i &lt; n; i++){
          num[i] = "9";
      };
      return num;
  }
  
  console.log(largestNumber(2));
  </code></pre>
  
  <p>I got an empty array instead of ["9", "9"]. Why is my array not forming?</p>