function renderBoard(board) {

	var strHTML = '';
	for (var i = 0; i < board.length; i++) {
		strHTML += '<tr>\n';
		for (var j = 0; j < board[0].length; j++) {
			var currCell = board[i][j];

			var cellClass = getClassName({ i: i, j: j })

			// TODO - change to short if statement
			if (currCell.type === FLOOR) cellClass += ' floor';
			else if (currCell.type === WALL) cellClass += ' wall';

			//TODO - Change To ES6 template string
			// strHTML += '\t<td class="cell ' + cellClass + '"  onclick="moveTo(' + i + ',' + j + ')" >\n';
			strHTML += `\t<td class="cell ${cellClass}"onClick="moveTo(${i},${j})">`
			// TODO - change to switch case statement
			if (currCell.gameElement === GAMER) {
				strHTML += GAMER_IMG;
			} else if (currCell.gameElement === BALL) {
				strHTML += BALL_IMG;
			}

			strHTML += '\t</td>\n';
		}
		strHTML += '</tr>\n';
	}

	// console.log('strHTML is:');
	// console.log(strHTML);
	var elBoard = document.querySelector('.board');
	elBoard.innerHTML = strHTML;
}
// Render the board to an HTML table
Render the board to an HTML table
Render the board to an HTML table
function renderBoard(board) {
	var strHTML = '';
	for (var i = 0; i < board.length; i++) {
		strHTML += '<tr>\n';
		for (var j = 0; j < board[0].length; j++) {
			var currCell = board[i][j];
			var cellClass = getClassName({ i: i, j: j })
			if (currCell.type === FLOOR) cellClass += ' floor';
			else if (currCell.type === WALL) cellClass += ' wall';
			strHTML += `\t<td class="cell ${cellClass}"onClick="moveTo(${i},${j})">`
			if (currCell.gameElement === GAMER) {
				strHTML += GAMER_IMG;
			} else if (currCell.gameElement === BALL) {
				strHTML += BALL_IMG;
			}
			strHTML += '\t</td>\n';
		}
		strHTML += '</tr>\n';
	}
	var elBoard = document.querySelector('.board');
	elBoard.innerHTML = strHTML;
}
function renderBoard ( board ) { var strHTML = '' ; for ( var i = 0 ; i < board . length ; i ++ ) { strHTML += '<tr>\n' ; for ( var j = 0 ; j < board [ 0 ] . length ; j ++ ) { var currCell = board [ i ] [ j ] ; var cellClass = getClassName ( { i : i , j : j } ) if ( currCell . type === FLOOR ) cellClass += ' floor' ; else if ( currCell . type === WALL ) cellClass += ' wall' ; strHTML += ` \t ${ cellClass } ${ i } ${ j } ` if ( currCell . gameElement === GAMER ) { strHTML += GAMER_IMG ; } else if ( currCell . gameElement === BALL ) { strHTML += BALL_IMG ; } strHTML += '\t</td>\n' ; } strHTML += '</tr>\n' ; } var elBoard = document . querySelector ( '.board' ) ; elBoard . innerHTML = strHTML ; }
Render the board to an HTML table
Render the board to an HTML table
// TODO - change to short if statement //TODO - Change To ES6 template string // strHTML += '\t<td class="cell ' + cellClass + '"  onclick="moveTo(' + i + ',' + j + ')" >\n'; // TODO - change to switch case statement // console.log('strHTML is:'); // console.log(strHTML);