+ 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
1 Answer
+ 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).