← Back to challenges

Something in the Box?

JavaScriptHardsortingformattingvalidationloops

Instructions

Create a function that returns true if an asterisk * is inside a box.

Examples

inBox([
  "###",
  "#*#",
  "###"
]) ➞ true

inBox([
  "####",
  "#* #",
  "#  #",
  "####"
]) ➞ true

inBox([
  "*####",
  "# #",
  "#  #*",
  "####"
]) ➞ false

inBox([
  "#####",
  "#   #",
  "#   #",
  "#   #",
  "#####"
]) ➞ false

Notes

The asterisk may be in the array, however, it must be inside the box, if it exists.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Capitalize the First Letter of Each Word