[Javascript] Commented Solution
\n\n/**\n * @param {number} rows\n * @param {number} cols\n * @param {number} rStart\n * @param {number} cStart\n * @return {number[][]}\n */\n var spiralMatrix
\n```\n/**\n * @param {number} rows\n * @param {number} cols\n * @param {number} rStart\n * @param {number} cStart\n * @return {number[][]}\n */\n var spiralMatrixIII = function(rows, cols, rStart, cStart) {\n    let r = rStart, c = cStart, results = [];\n    results.push([r,c]);\n    // Draw a picture of an infinite grid, then highlight a smaller grid inside with ${rows} of rows and ${cols} of columns.\n    // Draw a little man at the rStart row and the cStart column.\n    // We will tell the man to walk a number of steps in a certain direction.\n    // if the man is on a highlighted square, he will collect it.\n    const walk = (steps,rStep,cStep) => {\n        for (let i =0;i<steps;i++) {\n            r +=rStep, c+=cStep;\n            if ( r>=0 && c >=0 && r < rows && c<cols) results.push([r,c]);\n        }\n    }\n    // we need to direct the little man how to walk\n    // first he will walk a distance of one step.\n    let distance = 1;  \n    // think about how he will walk the spiral.\n     \n    // we will tell the man to walk right 1 unit.\n    // after that he will walk down 1 unit.\n    let rDirection = 0, cDirection = 1;\n     \n    // then he walks left 2 units, then he walks up 2 units \n    // then he walks right 3 units, then walks down 3 units\n     \n    // do this pattern until he collects all the squares. \n    while (results.length < rows*cols) {\n        walk(distance,rDirection,cDirection);\n        [rDirection,cDirection] = [cDirection,rDirection];\n        walk(distance,rDirection,cDirection);\n        [rDirection,cDirection] = [-1*cDirection,-1*rDirection];\n        distance++;\n    }\n    return results;\n};\n```
['JavaScript']