0 1 2 3 4 15 16 17 18 5 14 23 24 19 6 13 22 21 20 7 12 11 10 9 8
spiralArray
should be a function.
testString: assert(typeof spiralArray=='function','spiralArray
should be a function.');
- text: spiralArray(3)
should return an array.
testString: assert(Array.isArray(spiralArray(3)), 'spiralArray(3)
should return an array.');
- text: spiralArray(3)
should return [[0, 1, 2],[7, 8, 3],[6, 5, 4]]
.
testString: assert.deepEqual(spiralArray(3), [[0, 1, 2], [7, 8, 3], [6, 5, 4]], 'spiralArray(3)
should return [[0, 1, 2],[7, 8, 3],[6, 5, 4]]
.');
- text: spiralArray(4)
should return [[0, 1, 2, 3],[11, 12, 13, 4],[10, 15, 14, 5],[9, 8, 7, 6]]
.
testString: assert.deepEqual(spiralArray(4), [[0, 1, 2, 3], [11, 12, 13, 4], [10, 15, 14, 5], [9, 8, 7, 6]], 'spiralArray(4)
should return [[0, 1, 2, 3],[11, 12, 13, 4],[10, 15, 14, 5],[9, 8, 7, 6]]
.');
- text: spiralArray(5)
should return [[0, 1, 2, 3, 4],[15, 16, 17, 18, 5],[14, 23, 24, 19, 6],[13, 22, 21, 20, 7],[12, 11, 10, 9, 8]]
.
testString: assert.deepEqual(spiralArray(5), [[0, 1, 2, 3, 4], [15, 16, 17, 18, 5], [14, 23, 24, 19, 6], [13, 22, 21, 20, 7], [12, 11, 10, 9, 8]], 'spiralArray(5)
should return [[0, 1, 2, 3, 4],[15, 16, 17, 18, 5],[14, 23, 24, 19, 6],[13, 22, 21, 20, 7],[12, 11, 10, 9, 8]]
.');
```