creating a nested loop of a chessboard in javascript
function chessboard() {
let columns = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
let rows = [1, 2, 3, 4, 5, 6, 7, 8];
const chessboard = [];
for(let i = 0; i<columns.length; i++){
let currentRow = [];
// console.log (columns[i])
for (let j = 0; j < rows.length; j++){
// console.log(rows[j]);
currentRow.push(`${columns[i]} - ${rows[j]}`)
}
// console.log(currentRow)
// return position
chessboard.push(currentRow)
}
console.log(chessboard)
return chessboard;
}
module.exports = chessboard;