Advertisement
Spocoman

Eiffel Tower

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