bacco

Rhomboid

Mar 17th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function num([ arge1 ]){
  2.     var n  =  Number(arge1);
  3.     var a;
  4.     var b;
  5.  
  6.     for (i = 0; i < n; i++) {
  7.        
  8.         a = n -1 - i;
  9.         b = 1 + i ;
  10.         console.log(`${" ".repeat(a)}${"* ".repeat(b)}`);
  11.      }
  12.     for (i = 1; i < n; i++) {
  13.         a = 0 + i;
  14.         b = n  -i;
  15.         console.log(`${" ".repeat(a)}${"* ".repeat(b)}`);
  16.      }
  17. }
  18. num(["5"])
  19.  
  20. //                 *
  21. //                * *
  22. //               * * *
  23. //              * * * *
  24. //             * * * * *
  25. //              * * * *
  26. //               * * *
  27. //                * *
  28. //                 *
Advertisement
Add Comment
Please, Sign In to add comment