From 9213c757431414016d47d69649631f9eeee929cc Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 15:49:12 -0400 Subject: [PATCH] Update Solutions_w02d02_morning_exercise --- .../Solutions_w02d02_morning_exercise | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise b/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise index 9c60de9..8df6b6a 100644 --- a/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise +++ b/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise @@ -125,8 +125,39 @@ var sheepShearers = [ => 3238 ``` +/////////////////////////// +SOLUTION: sheepShearer +var sheepShearers = [ + { + name: "Tim", + age: 20, + sheepCount: 18 + }, + { + name: "C3PO", + age: 200, + sheepCount: 320 + }, + { + name: "Cousin It", + age: Infinity, + sheepCount: 2900 + } +]; + + +var total = sheepShearers + .map(function(item) { + return item.sheepCount; + }) + .reduce(function(sum, num) { + return sum += num; + }); + +console.log(total); + #### FINISHED EARLY?: