text: const { NotImplementedError } = require('../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
   */
  function getMatrixElementsSum(matrix) {
    // throw new NotImplementedError('Not implemented');
    // remove line with error and write your code here
    return  (matrix.reduce( (sum,line,lineInd) => { 
  
      return  (sum + line.filter( (el,ind) =>!( (lineInd>0) && (!matrix[lineInd - 1][ind]) ) )
    
         .reduce( (sumOnLine,el) => sumOnLine+el,0 ))  // выдает число для каждой итерации
    
     }, 0))
  }
  
  module.exports = {
    getMatrixElementsSum
  };
  