Advertisement
Guest User

Sunglasses

a guest
Mar 19th, 2018
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function drawing([arg1]) {
  2.     let n = Number(arg1)
  3.  
  4.     //First row
  5.     console.log("*".repeat(2 * n) + " ".repeat(n) + "*".repeat(2 * n))
  6.  
  7.     //Middle rows
  8.     let middleRow = Math.floor(((n - 2) - 1) / 2)
  9.     for (var row = 0; row < n - 2; row++) {
  10.         if (row === middleRow) {
  11.             console.log("*" + "/".repeat(2 * n - 2) + "*" +
  12.                 "|".repeat(n) +
  13.                 "*" + "/".repeat(2 * n - 2) + "*")
  14.         } else {
  15.             console.log("*" + "/".repeat(2 * n - 2) + "*" + " ".repeat(n) + "*" + "/".repeat(2 * n - 2) + "*")
  16.         }
  17.  
  18.     }
  19.  
  20.     //Last row
  21.     console.log("*".repeat(2 * n) + " ".repeat(n) + "*".repeat(2 * n))
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement