The SpiralMatrix class is written in JavaScript. It takes in a perfect square integer and returns the integers from 0 to that input integer in spiral format starting from the center and going counterclockwise.
/* Input */
var spiralMatrix = new SpiralMatrix(24);
spiralMatrix.fillMatrix();
sample output:
Testing is done with Chai and Mocha. There are 14 passing tests which can be run in the terminal:
$npm test