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;
Also in JavaScript:
- send message to user facebook game
- JavaScript function that generates all combinations of a string.
- javascript detect touch screen device
- make indexOF in js
- implement cai webchat in react native
- js array.pop
- oncheck checkbox javascript
- input text react 2020
- click a link using jquery
- javascript ascending and descending
- remove last element from array javascript
- content type json
- node load file
- client timezone offset in JavaScript
- discord.js send message to specific channel
- multidimensional array javascript
- simple javascript code
- javascript create element in a new line
- await on observable
- indexing string in javascript
- react native slow performance after load iamges
- moment check valid date
- js remove json value duplicates
- how to implement a promise with daisy chaining in angular