why it's undefined | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 2

why it's undefined

Let's click 1 of the cells in the table and see... Cannot read the property 'style' of undefined. Why? https://code.sololearn.com/WcFT0K50zVKQ/?ref=app

22nd Jan 2018, 6:38 PM
Amadeus
Amadeus - avatar
1 ответ
+ 2
Hi, this is because the function you are creating to hook up to the onclick event of the element has no idea what 'area' is. Remember, you are creating the function that will be executed on each cell. Try alert(this.style...) instead so it will refer to itself (the element).
22nd Jan 2018, 7:07 PM
Michelle Dougenik
Michelle Dougenik - avatar