How many rows and columns are in an m x n matrix? A simple question: By definition, does an m x n matrix have m rows and n columns, or is it vice versa?
 A: An $m \times n$ matrix has $m$ rows and $n$ columns.
A: I suggest you always to check the notation on the book which you are using. I found sometimes this notation with different meaning. In advanced books, for example. Even the notation for linear maps as matrices. Sometimes they write $xT$.
A: Always check and make sure you have the right convention for the occasion. Usually m x n is rows x columns. I like to remember this as being in REVERSE alphabetical order - Rows by Columns, or R first then C. However, in Boyce & DiPrima's book "Elementary Differential Equations and Boundary Value Problems" an m x n matrix has m vertical columns and n horizontal rows.
However, when addressing elements within a matrix, it's the opposite. The element "a sub i,j" references the element in the ith row and jth column.
Lesson? Always check to make sure you have the correct convention!
A: Yes... It's m-rows and n-Columns.
Here is an example, how you can generate and read a matrix in JavaScript :)
let createMatrix = (m, n) => {
  let [row, column] = [[], []],
      rowColumn = m * n
  for (let i = 1; i <= rowColumn; i++) {
    column.push(i)
    if (i % n === 0) {
      row.push(column)
      column = []
    }
  }
  return row
}

let setColorForEachElement = (matrix, colors) => {
  let row = matrix.map(row => {
    let column = row.map((column, key) => {
      return { number: column, color: colors[key] }
    })
    return column
  })
  return row
} 

const colors = ['red', 'green', 'blue', 'purple', 'brown', 'yellow', 'orange', 'grey']
const matrix = createMatrix(6, 8)
const colorApi = setColorForEachElement(matrix, colors)

let table ='<table>'
colorApi.forEach(row => {
  table+='<tr>'
    row.forEach(column =>  table +=`<td style='background: ${column.color};'>${column.number}<td>` )
  table+='</tr>'
})

document.write(table);

