I want to make a reverse triangle using 'for' loop, which should look like this:
*****
 ****
  ***
   **
    *
This what I got:
*****
****
***
**
*
And this is my code:
function rightTriangle(n) {
  for (var i = 0; i <= n; i++) {
    for (var j = n - 1; j >= i; j--) {
      document.write('*');
    }
    document.write('<br>');
  }
}
rightTriangle(5);Please help me out with this task, I would be so appreciated!
 
     
     
     
     
     
    