pyramid

by Esther Mun

JavaScript

function pyramid() {
    var limit = 10;
    var line = "";
    

    // loop that will be adding spaces on the left
   for (var b = limit; b > 0; b--) {
        line = "$";
        for (var a = 0; a < b; a++) {
        line +="$";
    }console.log(line);
   
}

//loop that will build a string with the numbers
  /*for (var i = 1; i < limit; i++) {
                line = i + " ";

      for (var j = 1; j < i; j++) {
         line += i + " ";
         }

       console.log(line);
     }*/

}

pyramid();