← Back to challenges

Making a Box

JavaScriptHardstringsformatting

Instructions

Create a function that creates a box based on dimension n.

Examples

makeBox(5) ➞ [
  "#####",
  "#   #",
  "#   #",
  "#   #",
  "#####"
]

makeBox(3) ➞ [
  "###",
  "# #",
  "###"
]

makeBox(2) ➞ [
  "##",
  "##"
]

makeBox(1) ➞ [
  "#"
]

Notes

N/A

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.