text: import { NotImplementedError } from '../extensions/index.js';
  
  /**
   * Given matrix, a rectangular matrix of integers,
   * just add up all the values that don't appear below a "0".
   *
   * @param {Array<Array>} matrix
   * @return {Number}
   *
   * @example
   * matrix = [
   *  [0, 1, 1, 2],
   *  [0, 5, 0, 0],
   *  [2, 0, 3, 3]
   * ]
   *
   * The result should be 9
   */
  export default function getMatrixElementsSum(matrix) {
    // const resultArr = matrix.flat(1);
    const heihgt = matrix.length;
    const width = matrix[0].length;
    let sum = 0;
    for (let i = 0; i < heihgt; i++) {
      for (let j = 0; j < width; j++) {
        if (i === 0) {
          sum += matrix[i][j];
        } else if (matrix[i - 1][j] !== 0) {
          sum += matrix[i][j];
        }
      }
    }
    return sum;
    // throw new NotImplementedError('Not implemented');
    // remove line with error and write your code here
  }
  