Unable to apply proper if condition
Edit: I have put the code below. Please kindly help as much as you can. I will be grateful https://code.sololearn.com/W6I2TCWqa5En/# I wrote the following **if condition** so that if the the td is empty the innerHTML should be '0'. But even when the innerHTML is "X" and not ''(empty), it still change the (X) to 0. The first condition that turn it to X is: ``` if(w==2 && zero.innerHTML==''){ zero.innerHTML='X'; w=1; } else if(w==2 && one.innerHTML==''){ one.innerHTML='X'; w=1; } else if(w==2 && two.innerHTML==''){ two.innerHTML='X'; w=1; } ``` But still: ``` if(w==1 && zero.innerHTML==''){ zero.addEventListener('click',function(){ zero.innerHTML='O'; w=2; }) } if(w==1 && one.innerHTML==''){ one.addEventListener('click',function(){ one.innerHTML='O'; w=2; }) } if(w==1 && two.innerHTML==''){ two.addEventListener('click',function(){ two.innerHTML='O'; w=2; }) } ``` Changes it to 'X' to '0'. Please any help will be appreciated