Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


My code for the drawHTMLBoard() method

Hello, I wanted to know if my code below for the drawHTMLBoard() method is also right? Thanks!

class Board {
    constructor() {
        this.rows = 6;
        this.columns = 7;
        this.spaces = this.createSpaces();

     * Generates 2D array of spaces. 
     * @return  {array}     An array of space objects
    createSpaces() {
        const spaces = [];

        for (let x = 0; x < this.columns; x++) {
            const col = [];

            for (let y = 0; y < this.rows; y++) {
                const space = new Space(x, y);


        return spaces;

     * Draws associated SVG spaces for all game spaces

    drawHTMLBoard() {
        for(let i = 0; i < this.spaces; i++) {