JavaScript Object-Oriented JavaScript: Challenge Rendering the Game startGame() Method Solution

Lauren Waller
Lauren Waller
8,530 Points

Start Button not working at all

var game = new Game();

var beginGameBtn = document.getElementById('begin-game');

/**

  • Listens for click on #begin-game and calls startGame() on game object */ beginGameBtn.addEventListener('click', function() { game.startGame();

    this.style.display = 'none'; document.getElementById('play-area').style.opacity = '1'; });

its saying that Game(); is undefined

1 Answer

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 48,710 Points

Does <script src = "js/Game.js"></script> come before <script src = "js/app.js"></script> in index.html? Can you post your code for index.html?