Skip to content

Instantly share code, notes, and snippets.

View jrrio's full-sized avatar

João Rodrigues jrrio

View GitHub Profile
@jrrio
jrrio / reduce_Object.md
Created April 23, 2018 15:06
Calculate the average of Object properties using for...in loop, Object.keys(), Object.values(), and Object.entries()

Calculate the average of Object properties

Here is our Object literal with some properties. What we need to do is calculate the average height of a set of people using JavaScript.

const data = {
  "Matt": { "height" : 176, "weight": 87 },
  "Jason": { "height" : 190, "weight": 103 },
  "Peter": { "height" : 180, "weight": 98 }
};