Created
May 11, 2014 00:27
-
-
Save gingerrific/c5b78503b3f70404c482 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 averagePrice = items.reduce(function (arrayZero, arrayOne) { | |
| console.log((arrayZero.price + arrayOne.price)/items.length); | |
| return {price: arrayZero.price + arrayOne.price}; | |
| }) | |
| averagePrice.price = +(averagePrice.price/items.length).toFixed(2); | |
| // averagePrice.price = +(averagePrice.price).toFixed(2); | |
| console.log("The average price is $", averagePrice.price); | |
| items.forEach(function (array) { | |
| if (array.currency_code == "GBP") { | |
| console.log(array.title + "Costs £" + array.price) | |
| } | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment