Created
May 25, 2016 08:13
-
-
Save drawveloper/9ea7a1ae9368469b5a0572da8b877eeb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var students = [ | |
{ name: "John", grades: [7.0, 6.9, 8.0], class: "A" }, | |
{ name: "Paul", grades: [5.0, 8.7, 3.7], class: "A" }, | |
{ name: "Luke", grades: [9.0, 8.2, 6.2], class: "B" }, | |
{ name: "Mark", grades: [6.0, 9.0, 8.4], class: "B" } | |
]; | |
var sum = function (numbers) { return _.reduce(numbers, function (sum, n) { return sum + n }, 0) } | |
var average = function (numbers) { return sum(numbers) / numbers.length } | |
var isApproved = function (student) { return average(student.grades) >= 7 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment