Number of rectangles in N * M grid | Javascript Code to count number of rectangles in N * M grid ; Driver code
function rectCount ( n , m ) { return parseInt ( ( m * n * ( n + 1 ) * ( m + 1 ) ) / 4 , 10 ) ; } let n = 5 , m = 4 ; document . write ( rectCount ( n , m ) ) ;