Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (var b = 0; b < allBoxes.length; b++) {
- allBoxes[b].onclick = function() {
- this.innerHTML = "X";
- this.style.color = "#fe7bff";
- // Add some competition
- var ai = Math.floor((Math.random() * allBoxes.length) );
- console.log(ai); // Pattern of errors at certain indices?
- if (allBoxes[ai] === "") {
- allBoxes[ai].innerHTML = "O";
- allBoxes[ai].style.color = "#ffdb00";
- } else {
- "Y"; // When is "else" executed?
- allBoxes[ai].style.color = "#ffdb00";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement