0

Can sombody help me with my code

https://code.sololearn.com/WeSlD2ia2Ggt/#js I was doing really well with my code when I try to run it said "Unable to get property 'style' of undefined or null reference Line: 71" I'm making a game called tic tag toe, so can someone help me and explain what I did wrong. Thanks

18th Jun 2018, 7:31 PM
AnimeGamer362
AnimeGamer362 - avatar
3 Answers
+ 5
I made some fixes. You tried to use the DOM prior to it existing. You had variables with uppercase in one place and lowercase elsewhere. https://code.sololearn.com/Wi90MPU8BTpt
18th Jun 2018, 8:04 PM
John Wells
John Wells - avatar
+ 3
John wells thank you so much!
18th Jun 2018, 8:49 PM
AnimeGamer362
AnimeGamer362 - avatar
0
Script is calling startGame function before the page is loaded, so there no "endgame" class object exists. There are two ways to fix that issue: remove the autocall of startGame function, so the game would start manually or bind the first startGame call to window.onload event. And yes, as the previous commenter had noted, startGame function is lowercase everywhere except binding it in html to button click even - there it is uppercase - "StartGame".
18th Jun 2018, 8:09 PM
Дмитро Іванов
Дмитро Іванов - avatar