Untitled

mail@pastecode.io avatar
unknown
javascript
6 months ago
568 B
1
Indexable
Never
class GameMaster {
    
    player.placeMarker()
    // Do other stuff here
}



class Player {
    placeMarker(squareIndex) {
        square.markerPlaced = squareIndex
    }
}


class Square {
    markerPlaced = null;
}


// index.html
<ul>
    <li class="square"></li>
    <li class="square"></li>
    <li class="square"></li>
    <li class="square"></li>
    <li class="square"></li>
</ul>
<script>
    const squares = document.querySelectorAll('.square')
    squares.forEeach(square => {
        square.addEventListener('click', getIndexOfSquare);
    })
</script>
Leave a Comment