JavaScript Print Triangle using javascript function print triangle using recursion,print triangle using python,print triangle

function makeLine(length) {
  var line = "";
  for (var i = 1; i <= length; i++) {
    for (var j = 1; j <= i; j++) {
      line += "*";

    }

  }
  return line + "\n";
}
console.log(makeLine(2));
Answer:1

The \n was at an incorrect position.

function makeLine(length) {
  var line = "";
  for (var i = 1; i <= length; i++) {
    for (var j = 1; j <= i; j++) {
      line += "*";

    }
    line += "\n";
  }
  return line;
}
console.log(makeLine(5));
Answer:2

don't forget about .repeat()

function makeLine(length) {
  var line = "";
  for (var i = 1; i <= length; i++) {
    line+="*".repeat(i)+"\n";
  }
  return line;
}
console.log(makeLine(3));
Answer:3
function makeLine(length) {
 var line = "";
 for (var i = 1; i <= length; i++) {
   for (var j = 1; j <= i; j++) {
       line += "*";
   }
   // add new line after loop is completed
   line = line + "\n"
}
return line + "\n";

} console.log(makeLine(5));`

you need to add \n to line when the inner loop is completed

Answer:4

I want to substract 1 month from the selected date and get it in this format mm/dd/yyyy self.SelectedDate = "02/22/2018"; var temp = new Date(self.SelectedDate); temp.setDate(temp.getDate() - 30);...

I want to substract 1 month from the selected date and get it in this format mm/dd/yyyy self.SelectedDate = "02/22/2018"; var temp = new Date(self.SelectedDate); temp.setDate(temp.getDate() - 30);...

  1. subtract month from date
  2. subtract month from date sql
  3. subtract month from date python
  4. subtract month from date javascript
  5. subtract month from date oracle
  6. subtract month from date r
  7. subtract month from current date in sql
  8. subtract month from date dax
  9. subtract month from pandas datetime
  10. subtract month from date in sas
  11. subtract month from date in excel
  12. subtract month from date c#
  13. subtract month from date pandas
  14. subtract month from date php
  15. subtract month from date mysql
  16. subtract month from date java
  17. subtract month from date in hive
  18. subtract month from current date in c#
  19. subtract month from date js
  20. subtract month from date sql oracle

<audio id="audio1" src="a.wav"></audio> <audio id="audio2" src="b.wav"></audio> <img id="img1" src="a.png" alt="" onselect="select()" /> <img id="img2" src="a.png" ...

<audio id="audio1" src="a.wav"></audio> <audio id="audio2" src="b.wav"></audio> <img id="img1" src="a.png" alt="" onselect="select()" /> <img id="img2" src="a.png" ...

I have an application that serves SSRS reports. A given report is accessed in the following way: https://reportserver.com/reportname Upon clicking View Report, a postback is submitted to the report ...

I have an application that serves SSRS reports. A given report is accessed in the following way: https://reportserver.com/reportname Upon clicking View Report, a postback is submitted to the report ...

  1. birt report parameters query string
  2. ssrs report parameters query string

I want to retrieve one row from database and show this information on my page. The problem is that subscribe is async so it's not executed immediately therefore I can't access the data from the ...

I want to retrieve one row from database and show this information on my page. The problem is that subscribe is async so it's not executed immediately therefore I can't access the data from the ...

  1. canvas
  2. canada
  3. cancelled
  4. canceled vs cancelled
  5. cancun
  6. canada goose
  7. cane corso
  8. canes
  9. canadian prime minister
  10. cancun flights
  11. canker sore
  12. candy
  13. cancer
  14. canon
  15. canvas prints
  16. cancer sign
  17. candace owens
  18. canada news
  19. candytopia
  20. canlis