Firefox выдает ошибку размера распределения в строке шаблона
hey guys i dont seem to know whats the problem here, never encountered before, i get allocation size error in the console, and the IDE telling me the string too long too, second question is how do i apply this shuffle function into the code? var gNums = [] var gInterval = null var gBoard = creatBoard() renderBoard() function renderBoard() { strHtml = '' for (var i = 0; i < gBoard.length; i++) { var row = gBoard[i] strHtml += '<tr>' for (var j = 0; j < row.length; i++) { cellvalue = row[j].value var className = (row[j].isClicked) ? 'clicked' : '' strHtml += ` <td class="${className}" onclick="numClicked(this)"> ${cellvalue} </td> ` } strHtml += `</tr>` } var ElBoard = document.querySelector('.board') ElBoard.innerHTML = str.strHtml } function creatBoard(difficulty = 16) { resetNums() var board = [] for (var i = 0; i < Math.sqrt(difficulty); i++) { board[i] = [] for (var j = 0; j < Math.sqrt(difficulty); j++) { board[i][j] = creatCell() } } return board } function creatCell() { var num = gNums.splice(gNums.length - 1, 1) return { value: Number(num), isClicked: false } } resetNums() function resetNums(difficulty = 16) { gNums = [] for (var i = 0; i <= difficulty; i++) { gNums.push(i) } return gNums } function shuffle(array) { var m = array.length, t, i; while (m) { i = Math.floor(Math.random() * m--); t = array[m]; array[m] = array[i]; array[i] = t; } return array; }
Что я уже пробовал:
я попробовал разбить строку пробелами для большей читабельности и найти ошибку, которая выглядит нормально.