File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -25,8 +25,8 @@ box.forEach((box) => {
2525 turnX = true
2626 }
2727 box . disabled = true
28+ checkdraw ( ) ;
2829 checkwinner ( ) ;
29- checkdraw ( ) ;
3030
3131 } )
3232
@@ -56,20 +56,19 @@ for(let pattern of winningpattern){
5656
5757 checkdraw = function ( ) {
5858 isdraw = true ;
59- for ( i = 0 ; i < 9 ; i ++ ) {
59+ for ( i = 0 ; i < box . length ; i ++ ) {
6060 if ( box [ i ] . innerText === '' ) {
61-
62-
6361 isdraw = false ;
6462 break ;
6563 }
64+
6665 }
6766 if ( isdraw ) {
6867 status = "draw"
6968 msgprint ( ) ;
7069 }
71-
7270 }
71+
7372msgprint = ( ) => {
7473 if ( status === 'win' )
7574 {
@@ -78,12 +77,11 @@ msgprint=()=>{
7877 }
7978else if ( status === 'draw' ) {
8079 msg . innerText = 'Game is Draw'
81- disable ( ) ;
80+ disable ( ) ;
8281
8382}
8483}
8584
86-
8785 const disable = ( ) => {
8886 for ( let i of box ) {
8987 i . disabled = true ;
You can’t perform that action at this time.
0 commit comments