{"size": 677, "ext": "js", "max_stars_repo_path": "src/st-matrix-elements-sum.js", "max_stars_repo_name": "AlexGrin1/basic-js", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/st-matrix-elements-sum.js", "max_issues_repo_name": "AlexGrin1/basic-js", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/st-matrix-elements-sum.js", "max_forks_repo_name": "AlexGrin1/basic-js", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 17.358974359, "max_line_length": 61, "alphanum_fraction": 0.5553914328}
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(arr) {

	let arr1=[]
	for(let i=0;i<arr[0].length;i++){
		arr1[i]=[]
		for (let j=0;j<arr.length;j++){
			arr1[i].push(arr[j][i])
		}
	}
let sum=0
	arr1.map(el=>{
			for(let i=0;i<el.length;){
				if(el[i]==0){
					break
				}
				else{sum+=el[i];i++}
			}
		})
	return sum	
}
