The code is not related to Tic-Tac-Toe. This is general JavaScript code. Not Specific.
All this do is check whether a document.all is present and whether getElementById function is present or not. Which is true for present World.
document.all list all elements and document.getElementById is a function which return the element with id that match the argument you pass.
Then write the HTML style code to document.
<style>
.tictac{
width:50px;
height:50px;
}
</style>
For your understanding, The snippet is below.
I added a div with class=tictac and styled it with background-color black
When you run the snippet, the size of div is set to 50x50 .
That is all this code do.
if (document.all||document.getElementById){
document.write('<style>.tictac{')
document.write('width:50px;height:50px;')
document.write('}</style>')
}
.tictac{
background-color:#000;
}
<div class="tictac">ABCD</div>
2
solved Tic Tac Toe program by using Javascript [closed]