/*
  Function name:  commas(num);
  Inputs:         A number, n.
  Returns:        A string representing the input, with commas inserted into the
                  correct position.
  Prints:         Nothing

  For example,

   commas(123);     == "123"
   commas(1234);    == "1,234"
   commas(12345);   == "12,345"
   commas(1234567); == "1,234,567"

  ** Note #1 **
  If it's too much, don't worry about handling negative numbers at first.

  ** Note #2 **
  As always, focus first on how you would do this *as a human*. Imagine you
  has a piece of paper with a comma-less number on it.  How would you decide to
  insert the commas?  Which comma would you insert first?
*/

function commas(num) {
  // You have to fill in the details here!  =]
}

/*
  Write some of your own "sanity checks" here.  Each check should look like:

   console.log(comma(); == ...expected return value...);

  A good sanity check is like a canary in a coal mine: when it fails we know
  something is very wrong in our code.  This means sanity checks should
  reflect;

    1. The common cases
    2. The edge cases
    3. Likely mistakes you'll make in your code (e.g., using <= instead of <)

  What these cases mean concretely depends on what your function does.

  ** Hint #1 **
  Use .toString(); to convert a number to a string.  That is,

    (5).toString();
      => "5"
    (100).toString();
      => "100"

  Remember: these are rumble strips, not a driving instructor.
  If any are "false" then something is broken. But just because they all return
  "true" doesn't mean you've nailed it. =]
*/

@@ -700,54 +700,682 @@
 %7B%0A  
-// You have to fill in the details here!  =%5D%0A%7D
+var numString = '';%0A%0A  numString += num;%0A%0A%0A%0A  return numString;%0A%0A%7D%0A%0Aconsole.log(commas(123)     == %22123%22);%0Aconsole.log(commas(1234)    == %221,234%22);%0Aconsole.log(commas(12345)   == %2212,345%22);%0Aconsole.log(commas(1234567) == %221,234,567%22);%0A%0A%0A/*%0AI need to bulid a new string, once character at a time.  If the index of the%0Acharacter I'm at is equal to three, I need to add a comma.%0A%0AHere's one way...%0A%0Avar numString = %22%22;%0Avar newString = %22%22;%0Avar char;%0A%0A  for (var i = 0; i %3C numString.length; i++) %7B%0A    char = numString.charAt(i);%0A    newString = newString + char;%0A    if (i %25 3 != 0 && (i %3C numString.length -1)) %7B%0A      newString = newString + ',';%0A    %7D%0A  %7D%0A%0Areturn newString;
 %0A%0A/*

Add partial solution for JS exercise comma