text: Program to check if a matrix is symmetric | Efficient Javascript code for check a matrix is symmetric or no ; Returns true if mat [ N ] [ N ] is symmetric , else false ; Driver code
code: let MAX = 100 ; function isSymmetric ( mat , N ) { for ( let i = 0 ; i < N ; i ++ ) for ( let j = 0 ; j < N ; j ++ ) if ( mat [ i ] [ j ] != mat [ j ] [ i ] ) return false ; return true ; } let mat = [ [ 1 , 3 , 5 ] , [ 3 , 2 , 4 ] , [ 5 , 4 , 1 ] ] ; if ( isSymmetric ( mat , 3 ) ) document . write ( " " ) ; else document . write ( " " ) ;