{"size": 848, "ext": "js", "max_stars_repo_path": "katas/grademeankata.js", "max_stars_repo_name": "kelly-obrazcova/first-js-repo", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "katas/grademeankata.js", "max_issues_repo_name": "kelly-obrazcova/first-js-repo", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "katas/grademeankata.js", "max_forks_repo_name": "kelly-obrazcova/first-js-repo", "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": 36.8695652174, "max_line_length": 222, "alphanum_fraction": 0.7370283019}
/* 
https://www.codewars.com/kata/get-the-mean-of-an-array/train/javascript

It's the academic year's end, fateful moment of your school report. The averages must be calculated. All the students come to you and entreat you to calculate their average for them. Easy ! You just need to write a script.
Return the average of the given array rounded down to its nearest integer.
The array will never be empty. 
*/

//get an average grade from an array of marks
//this code passes

function getAverage(marks) {
	var totalScore = 0;
	marks.forEach(function(element){
		totalScore = totalScore + element;
		return totalScore;
	})
	return Math.floor(totalScore / marks.length);
}

//sample test: getAverage([2, 2, 2, 2]); should return 2
//sample test: getAverage([1,2,3,4,5,]); should return 3
//sample test: getAverage([1,1,1,1,1,1,1,2]); should return 1