Advertisement
Spocoman

Skyscraper

Sep 25th, 2023
484
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function skyscraper(input) {
  2.     let n = parseInt(input);
  3.  
  4.     for (let row = 0; row < n - 3; row++) {
  5.         console.log(' '.repeat(n) + "|" + ' '.repeat(n));
  6.     }
  7.  
  8.     console.log(' '.repeat(n - 1) + "_|_" + ' '.repeat(n - 1));
  9.  
  10.     for (let row = 0; row < n - 3; row++) {
  11.         console.log(' '.repeat(n - 1) + "|-|" + ' '.repeat(n - 1));
  12.     }
  13.  
  14.     console.log(' '.repeat(n - 2) + "_|-|_" + ' '.repeat(n - 2));
  15.  
  16.     for (let row = 0; row < n - 3; row++) {
  17.         console.log(' '.repeat(n - 2) + "|***|" + ' '.repeat(n - 2));
  18.     }
  19.  
  20.     console.log('_'.repeat(n - 3) + "|***|" + '_'.repeat(n - 3));
  21.  
  22.     for (let row = 0; row < n * 4 - 1; row++) {
  23.         console.log(" " + '|'.repeat(n - 2) + "---" + '|'.repeat(n - 2) + " ");
  24.     }
  25.  
  26.     console.log("_" + '|'.repeat(n - 2) + "---" + '|'.repeat(n - 2) + "_");
  27.  
  28.     for (let row = 0; row < n - 2; row++) {
  29.         console.log('|'.repeat(n * 2 + 1));
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement