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
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
+ 3
John wells thank you so much!
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".