Advertisement
Guest User

Untitled

a guest
Jan 19th, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function main(n) {
  2.  
  3.     for (let i = n - 1; i > 0; i--) {
  4.         let startResult = " "
  5.         startResult += (" ").repeat(i);
  6.         startResult += "* ".repeat(n - i)
  7.         console.log(startResult);
  8.     }
  9.  
  10.  
  11.     for (let i = 0; i < n; i++) {
  12.         let startResult = " "
  13.         startResult += (" ").repeat(i);
  14.         startResult += "* ".repeat(n - i)
  15.         console.log(startResult);
  16.     }
  17.  
  18.  
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement