Help, code not working as expected | SoloLearn: Learn to code for FREE!

+7

Help, code not working as expected

Check this code: https://code.sololearn.com/WkPwumi8GZbq/?ref=app If you execute the code the following happen: - Upon launch the first row doesn't get highlighted. - For every successive highlight, the last cells of the first row, first column and the first diagonal (top left to bottom right) do not get highlighted. What is wrong and how do I fix this?

3 Answers

New Answer

+3

https://code.sololearn.com/WKRmYCIs5UFu/#js

+2

I think it is because of the set time 300 ms. As an asynchronous function it waits for completion. Maybe because time gap is long enough it starts the next loop removing class name attribute "mark". I tried your code with time 100 ms and it works normally. https://code.sololearn.com/W6GY7fIuwB8j/?ref=app

-1