+ 5
Can anyone spot the problem?
In line 17, it checks if one of the winning scenarios is a subset of the placed marks. It should indicate when someone wins, but it always returns false, even when it SHOULD be true. When I tested it with other arrays, it returned true https://code.sololearn.com/WJAmTod96lFU/?ref=app
2 odpowiedzi
+ 3
Airree
The problem is that you are trying to compare strings with numbers. In this case index is a string. You can use unary operator '+' to convert index from string to number at line 15 Mark[turn].push(+index);
https://code.sololearn.com/WZr70zT0zCIs/?ref=app