function createBoardColor(color,figgarr,pwnsarr){
const boardFigers = figgarr.map((el) => `${color} ${el}` )
const boardPawns = pwnsarr.map((el) => `${color} ${el}`)
return [...boardFigers,...boardPawns]
}
 
function generateChessboard() {
const figures = ['Ладья', 'Конь', 'Слон', 'Ферзь', 'Король', 'Слон', 'Конь', 'Ладья'];
const pawns = new Array(8).fill('Пешка');
const board = []
const bordWhite = createBoardColor('Б',figures,pawns)
 
const bordBlack = createBoardColor('Ч',figures,pawns).reverse()
 
 
 
board.push(bordWhite,bordBlack)
 
return board
 
}
 
// console.log(generateChessboard());
 
function renderChessboard() {
const emojis = {
'Б Ферзь': '♕',
'Б Король': '♔',
'Б Слон': '♗',
'Б Конь': '♘',
'Б Ладья': '♖',
'Б Пешка': '♙',
'Ч Ферзь': '♛',
'Ч Король': '♚',
'Ч Слон': '♝',
'Ч Конь': '♞',
'Ч Ладья': '♜',
'Ч Пешка': '♟',
};
const boards = generateChessboard();
 
 
return boards.map((board) => {
return board.map((el) => emojis[el]) || "."
})
}
 
console.log(renderChessboard())
 
Code will run automatically after changes.
Code runs in an isolated environment.