Advertisement
Spocoman

Sublime Logo

Sep 24th, 2023
595
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function sublimeLogo(input) {
  2.     let n = Number(input);
  3.  
  4.     let output = "";
  5.  
  6.     let spaces = 2 * n - 2;
  7.     let stars = 2;
  8.  
  9.     for (let row = 0; row < n; row++) {
  10.         output += ' '.repeat(spaces) + '*'.repeat(stars) + "\n";
  11.         spaces -= 2;
  12.         stars += 2;
  13.     }
  14.  
  15.     spaces = 2;
  16.     stars = 2 * n - 2;
  17.  
  18.     for (let row = 0; row < 2; row++) {
  19.         output += '*'.repeat(stars) + ' '.repeat(spaces) + "\n";
  20.         spaces += 2;
  21.         stars -= 2;
  22.     }
  23.  
  24.     spaces = 2;
  25.     stars = 2 * n - 2;
  26.  
  27.     for (let row = 0; row < 2; row++) {
  28.         output += '*'.repeat(stars) + ' '.repeat(spaces) + "\n";
  29.         if (spaces > 0 && stars > 0) {
  30.             spaces -= 2;
  31.             stars += 2;
  32.         }
  33.     }
  34.  
  35.     spaces = 2;
  36.     stars = 2 * n - 2;
  37.  
  38.     for (let row = 0; row < 2; row++) {
  39.         output += ' '.repeat(spaces) + '*'.repeat(stars) + "\n";
  40.         spaces += 2;
  41.         stars -= 2;
  42.     }
  43.  
  44.     spaces = 2;
  45.     stars = 2 * n - 2;
  46.  
  47.     for (let row = 0; row < 2; row++) {
  48.         output += ' '.repeat(spaces) + '*'.repeat(stars) + "\n";
  49.         if (spaces > 0 && stars > 0) {
  50.             spaces -= 2;
  51.             stars += 2;
  52.         }
  53.     }
  54.  
  55.     spaces = 2;
  56.     stars = 2 * n - 2;
  57.  
  58.     for (let row = 0; row < n; row++) {
  59.         output += '*'.repeat(stars) + ' '.repeat(spaces) + "\n";
  60.         spaces += 2;
  61.         stars -= 2;
  62.     }
  63.  
  64.     console.log(output);
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement