Skip to content

Instantly share code, notes, and snippets.

View MuhammadHasham23's full-sized avatar
🎯
Focusing

Muhammad Hasham MuhammadHasham23

🎯
Focusing
View GitHub Profile
function spiralMatrix(total) {
var noOfRows = 0;
var noOfCols = 0;
var numbers = [];
for (let i = 0; i < Math.pow(total, 2); i++) {
numbers[i] = i + 1;
}
var numberIter = 0;
var newarr = [];
for (let i = 0; i < total; i++) {